Archived
1
Fork 0

Use multiple workers

This commit is contained in:
Jake Howard 2017-04-11 09:25:54 +01:00
parent 205d58efc3
commit 2b92acbc2a

View file

@ -1,11 +1,12 @@
from sanic import Sanic from sanic import Sanic
from lantern.route import main_route from lantern.route import main_route
import os
app = Sanic(__name__) app = Sanic(__name__)
def main(): def main():
workers = int(os.cpu_count()) or 1
app.add_route(main_route, "/<path>") app.add_route(main_route, "/<path>")
app.add_route(main_route, "/") app.add_route(main_route, "/")
app.run(host="0.0.0.0", port="8000") app.run(host="0.0.0.0", port=8000, workers=workers)