fix: dev: use ImportError instead ModuleNotFoundError (#437)

py3.5 compatibility
This commit is contained in:
rachmadani haryono 2020-02-09 08:33:49 +08:00 committed by GitHub
parent be12ef0114
commit 960247a8fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ from flask_bootstrap import Bootstrap
from flask_paginate import Pagination, get_page_parameter, get_per_page_parameter
try:
from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix
except ModuleNotFoundError:
except ImportError:
ReverseProxyPrefixFix = None
from markupsafe import Markup
import click
@ -242,7 +242,7 @@ def create_app(db_file=None):
if ReverseProxyPrefixFix:
ReverseProxyPrefixFix(app)
else:
raise ModuleNotFoundError('Failed to import ReverseProxyPrefixFix')
raise ImportError('Failed to import ReverseProxyPrefixFix')
bukudb = BukuDb(dbfile=app.config['BUKUSERVER_DB_FILE'])
app.app_context().push()
setattr(flask.g, 'bukudb', bukudb)