fix: dev: use ImportError instead ModuleNotFoundError (#437)
py3.5 compatibility
This commit is contained in:
parent
be12ef0114
commit
960247a8fb
@ -16,7 +16,7 @@ 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:
|
try:
|
||||||
from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix
|
from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix
|
||||||
except ModuleNotFoundError:
|
except ImportError:
|
||||||
ReverseProxyPrefixFix = None
|
ReverseProxyPrefixFix = None
|
||||||
from markupsafe import Markup
|
from markupsafe import Markup
|
||||||
import click
|
import click
|
||||||
@ -242,7 +242,7 @@ def create_app(db_file=None):
|
|||||||
if ReverseProxyPrefixFix:
|
if ReverseProxyPrefixFix:
|
||||||
ReverseProxyPrefixFix(app)
|
ReverseProxyPrefixFix(app)
|
||||||
else:
|
else:
|
||||||
raise ModuleNotFoundError('Failed to import ReverseProxyPrefixFix')
|
raise ImportError('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