forked from CenterForOpenScience/osf.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
27 lines (19 loc) · 800 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
# PATCH: avoid deadlock on getaddrinfo, this patch is necessary while waiting for
# the final gevent 1.1 release (https://github.com/gevent/gevent/issues/349)
# unicode('foo').encode('idna') # noqa
from psycogreen.gevent import patch_psycopg # noqa
patch_psycopg()
import os # noqa
from website import settings # noqa
from website.app import init_app # noqa
application = app = init_app('website.settings', set_backends=True, routes=True)
if __name__ == '__main__':
host = os.environ.get('OSF_HOST', None)
port = os.environ.get('OSF_PORT', None)
if port:
port = int(port)
app.run(host=host, port=port, extra_files=[settings.ASSET_HASH_PATH], threaded=settings.DEBUG_MODE)