#!/usr/bin/python from mgweb.mgweb import app as app from mgweb import queue import os import socket try: queue.start() f = open(os.path.dirname(os.path.realpath(__file__)) + '/tmp/serverpid.txt', 'r+') z = os.getpid() f.write(str(z)) f.close() app.run(host=socket.getfqdn(), threaded=True) finally: queue.stop()