server: make gunicorn friendly
This commit is contained in:
parent
6b42d787a7
commit
e5f250260d
|
@ -10,7 +10,7 @@ import argparse
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
import waitress
|
import waitress
|
||||||
from szurubooru.facade import create_app
|
from szurubooru.facade import app
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser('Starts szurubooru using waitress.')
|
parser = argparse.ArgumentParser('Starts szurubooru using waitress.')
|
||||||
|
@ -19,7 +19,6 @@ def main():
|
||||||
parser.add_argument('--host', help='IP to listen on', default='0.0.0.0')
|
parser.add_argument('--host', help='IP to listen on', default='0.0.0.0')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
app = create_app()
|
|
||||||
waitress.serve(app, host=args.host, port=args.port)
|
waitress.serve(app, host=args.host, port=args.port)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -113,3 +113,6 @@ def create_app():
|
||||||
rest.errors.handle(sqlalchemy.orm.exc.StaleDataError, _on_stale_data_error)
|
rest.errors.handle(sqlalchemy.orm.exc.StaleDataError, _on_stale_data_error)
|
||||||
|
|
||||||
return rest.application
|
return rest.application
|
||||||
|
|
||||||
|
|
||||||
|
app = create_app()
|
||||||
|
|
Loading…
Reference in New Issue