-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstart_iiifoo_server.py
37 lines (29 loc) · 1019 Bytes
/
start_iiifoo_server.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
28
29
30
31
32
33
34
35
36
37
import logging
try:
import settings # NOTE: DO NOT CHANGE TO `from settings import get`
except ImportError:
print "Unable to find `settings.py`. Please run "\
"`python populate_settings.py` to prep configurations first."
import sys
sys.exit(1)
import cron_jobs
import iiifoo_utils
from iiifoo_server import create_app
iiifoo_utils.write_iiifoo_crons(jobsmap=cron_jobs.JOBSMAP)
logger = logging.getLogger('start_mira_server')
fh = logging.FileHandler('iiifoo_server.log')
fh.setLevel(logging.DEBUG)
logger.setLevel(logging.DEBUG)
logger.addHandler(fh)
app = create_app()
if __name__ == '__main__':
# Assumes debugging is the intent.
port = int(settings.get("server_port"))
if settings.get('profiler'):
from werkzeug.contrib.profiler import ProfilerMiddleware
app.config['PROFILE'] = True
app.wsgi_app = ProfilerMiddleware(
app.wsgi_app,
profile_dir='profiling_results_target'
)
app.run(host='0.0.0.0', port=port)