Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def run(daemonize=False, db=None):
- from gevent import server
- if daemonize:
- pid = gevent.fork()
- if pid != 0:
- return pid
- else:
- gevent.reinit()
- db = db or settings.POSTGRESQL
- database.pool(*settings.POSTGRESQL_POOL,
- custom_settings=db)
- worker = Worker()
- srv = server.StreamServer(("0.0.0.0", settings.LISTEN_PORT),
- worker.handle_connection)
- try:
- srv.serve_forever()
- except KeyboardInterrupt:
- pass
- if __name__ == "__main__":
- run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement