import os
import sys
import uvloop
import asyncio
import virtool.args
import virtool.logs

from aiohttp import web
from setproctitle import setproctitle
from virtool.web import create_app

sys.dont_write_bytecode = True

setproctitle("virtool")

args = virtool.args.get_args()

logger = virtool.logs.configure(verbose=args.verbose)

if args.write_pid:
    logger.debug("Writing pid file")

    pid = str(os.getpid())
    pid_path = "/var/run/virtoold/virtoold.pid"

    if os.path.isfile(pid_path):
        logger.fatal("PID file already exists.")
        sys.exit(1)

    with open(pid_path, "w") as pidfile:
        pidfile.write(pid)


asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())

loop = asyncio.get_event_loop()

if __name__ == "__main__":
    app = create_app(loop)
    web.run_app(app)
    server = virtool.web.Application(args.development)

@@ -46,48 +46,8 @@
 ncio
-%0Aimport virtool.args%0Aimport virtool.logs
 %0A%0Afr
@@ -140,16 +140,85 @@
 eate_app
+%0Afrom virtool.logs import configure%0Afrom virtool.args import get_args
 %0A%0Asys.do
@@ -279,21 +279,8 @@
 s = 
-virtool.args.
 get_
@@ -300,21 +300,8 @@
 r = 
-virtool.logs.
 conf
@@ -802,61 +802,35 @@
 (app
-)%0A    server = virtool.web.Application(args.development
+, host=%22localhost%22, port=9950
 )%0A

Clean up run.py