Configured to run behind reverse proxy, using Gunicorn

This commit is contained in:
Punnamaraju Vinayaka Tejas 2023-07-12 12:47:01 +05:30
parent c7df4ad6dc
commit f52d98333e
3 changed files with 9 additions and 3 deletions

View file

@ -1,5 +1,6 @@
import os
from flask import Flask
from werkzeug.middleware.proxy_fix import ProxyFix
def create_app(test_config=None):
# create and configure the app
@ -9,6 +10,10 @@ def create_app(test_config=None):
DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
)
app.wsgi_app = ProxyFix(
app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1
)
if test_config is None:
# load the instance config, if it exists, when not testing
app.config.from_pyfile('config.py', silent=True)