Mercurial > piecrust2
comparison piecrust/admin/web.py @ 783:a9f4a6e60b0b
admin: Fix various crashes caused by incorrect Blueprint setup.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 28 Aug 2016 20:48:05 -0700 |
parents | 5e91bc0e3b4d |
children | 8f2d32f90095 |
comparison
equal
deleted
inserted
replaced
782:df58592b40f8 | 783:a9f4a6e60b0b |
---|---|
1 import os.path | 1 import os.path |
2 import logging | 2 import logging |
3 from flask import Flask | 3 from flask import Flask |
4 from werkzeug import SharedDataMiddleware | 4 from werkzeug import SharedDataMiddleware |
5 from .blueprint import foodtruck_bp, login_manager, bcrypt_ext | 5 from .blueprint import foodtruck_bp |
6 from .configuration import FoodTruckConfigNotFoundError | 6 from .configuration import FoodTruckConfigNotFoundError |
7 from .sites import InvalidSiteError | 7 from .sites import InvalidSiteError |
8 | 8 |
9 | 9 |
10 logger = logging.getLogger(__name__) | 10 logger = logging.getLogger(__name__) |
11 | 11 |
12 | 12 |
13 def create_foodtruck_app(extra_settings=None): | 13 def create_foodtruck_app(extra_settings=None): |
14 app = Flask(__name__) | 14 app = Flask(__name__.split('.')[0]) |
15 app.config.from_object('piecrust.admin.settings') | 15 app.config.from_object('piecrust.admin.settings') |
16 app.config.from_envvar('FOODTRUCK_SETTINGS', silent=True) | 16 app.config.from_envvar('FOODTRUCK_SETTINGS', silent=True) |
17 if extra_settings: | 17 if extra_settings: |
18 app.config.update(extra_settings) | 18 app.config.update(extra_settings) |
19 | 19 |
60 # correctly installed so it shows the installation information page. | 60 # correctly installed so it shows the installation information page. |
61 app.secret_key = 'temp-key' | 61 app.secret_key = 'temp-key' |
62 _missing_secret_key = True | 62 _missing_secret_key = True |
63 | 63 |
64 # Register extensions and blueprints. | 64 # Register extensions and blueprints. |
65 login_manager.init_app(app) | |
66 bcrypt_ext.init_app(app) | |
67 app.register_blueprint(foodtruck_bp) | 65 app.register_blueprint(foodtruck_bp) |
68 | 66 |
69 logger.debug("Created FoodTruck app with admin root: %s" % admin_root) | 67 logger.debug("Created FoodTruck app with admin root: %s" % admin_root) |
70 | 68 |
71 return app | 69 return app |