Feature/fix reverse proxy (#435)
* new: dev: raise error when used * chg: dev: add info on error
This commit is contained in:
parent
5638226883
commit
5a23be2ab7
@ -14,7 +14,10 @@ from flask_admin import Admin
|
|||||||
from flask_api import exceptions, FlaskAPI, status
|
from flask_api import exceptions, FlaskAPI, status
|
||||||
from flask_bootstrap import Bootstrap
|
from flask_bootstrap import Bootstrap
|
||||||
from flask_paginate import Pagination, get_page_parameter, get_per_page_parameter
|
from flask_paginate import Pagination, get_page_parameter, get_per_page_parameter
|
||||||
|
try:
|
||||||
from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix
|
from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
ReverseProxyPrefixFix = None
|
||||||
from markupsafe import Markup
|
from markupsafe import Markup
|
||||||
import click
|
import click
|
||||||
import flask
|
import flask
|
||||||
@ -236,7 +239,10 @@ def create_app(db_file=None):
|
|||||||
if reverse_proxy_path.endswith('/'):
|
if reverse_proxy_path.endswith('/'):
|
||||||
print('Warning: reverse proxy path should not include trailing slash')
|
print('Warning: reverse proxy path should not include trailing slash')
|
||||||
app.config['REVERSE_PROXY_PATH'] = reverse_proxy_path
|
app.config['REVERSE_PROXY_PATH'] = reverse_proxy_path
|
||||||
|
if ReverseProxyPrefixFix:
|
||||||
ReverseProxyPrefixFix(app)
|
ReverseProxyPrefixFix(app)
|
||||||
|
else:
|
||||||
|
raise ModuleNotFoundError('Failed to import ReverseProxyPrefixFix')
|
||||||
bukudb = BukuDb(dbfile=app.config['BUKUSERVER_DB_FILE'])
|
bukudb = BukuDb(dbfile=app.config['BUKUSERVER_DB_FILE'])
|
||||||
app.app_context().push()
|
app.app_context().push()
|
||||||
setattr(flask.g, 'bukudb', bukudb)
|
setattr(flask.g, 'bukudb', bukudb)
|
||||||
|
Loading…
Reference in New Issue
Block a user