-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrun.py
More file actions
28 lines (18 loc) · 658 Bytes
/
run.py
File metadata and controls
28 lines (18 loc) · 658 Bytes
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
import os
from werkzeug.middleware.proxy_fix import ProxyFix
from app import create_app, socketio
def fix_werkzeug_logging():
from werkzeug.serving import WSGIRequestHandler
def address_string(self):
forwarded_for = self.headers.get(
'X-Forwarded-For', '').split(',')
if forwarded_for and forwarded_for[0]:
return forwarded_for[0]
else:
return self.client_address[0]
WSGIRequestHandler.address_string = address_string
config_name = os.getenv('FLASK_ENV')
app = create_app(config_name)
app.wsgi_app = ProxyFix(app.wsgi_app)
if __name__ == '__main__':
socketio.run(app)