-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun.py
56 lines (33 loc) · 1.4 KB
/
run.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/python
# -*- coding: utf-8 -*-
from application import app
import gevent
import gevent.monkey
from gevent.pywsgi import WSGIServer
gevent.monkey.patch_all()
# ------- PRODUCTION CONFIG -------
if __name__ == '__main__':
try:
INTERFACE = app.config['INTERFACE']
# ----------------- For HTTPS -------------------#
HTTPS_PORT = app.config['HTTPS_PORT']
SSL_CERTFILE = app.config['SSL_CERTFILE']
SSL_KEYFILE = app.config['SSL_KEYFILE']
server = WSGIServer((INTERFACE, HTTPS_PORT), app, certfile=SSL_CERTFILE, keyfile=SSL_KEYFILE,log=app.logger)
if server:
print "Server Started on: https://"+str(INTERFACE)+":"+str(HTTPS_PORT)+"/"
# ---------------- For HTTP Only ----------------#
# HTTP_PORT = app.config['HTTP_PORT']
# server = WSGIServer((INTERFACE, HTTP_PORT), app,log=app.logger)
# if server:
# print "Server Started on: http://"+str(INTERFACE)+":"+str(HTTP_PORT)+"/"
# -------Common for both HTTP and HTTPS----------#
# server.serve_forever()
except KeyboardInterrupt:
print "\nUser Abort Identified. Good Bye\n"
# ------- DEVELOPMENT CONFIG -------
# if __name__ == "__main__":
# INTERFACE = app.config['INTERFACE']
# PORT = app.config['HTTP_PORT']
# DEBUG = app.config['DEBUG']
# app.run(host=INTERFACE,port=PORT,debug=DEBUG)