-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwsgi.py
31 lines (26 loc) · 1.01 KB
/
wsgi.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
# Author: Chirag Chamoli
# -*- coding: utf-8 -*-
import os
import yaml
from framework.application import application as app
with open('globals.yaml', 'r') as f:
globals = yaml.load(f)
def server_shutdown(msg):
raise RuntimeError(msg)
if __name__ == "__main__":
with app.app_context():
possible_envs = ['local','staging','prod']
env = os.environ.get("FLASK_ENV")
if env in possible_envs :
pass
else:
server_shutdown("Please configure environment properly!.")
if env == 'local':
context = (globals['local_certs']['crt'], globals['local_certs']['key'])
app.run(host=app.config['HOST'], port=app.config['PORT'],ssl_context=context, use_reloader = True)
else:
#init_db(True)
#app.logger.handlers.extend(gunicorn_error_logger.handlers)
#app.logger.setLevel(logging.DEBUG)
#app.run(host=app.config['HOST'], port=app.config['PORT'], threaded=app.config['IS_THREADED'])
pass