from byceps.application import create_app, init_app from byceps.blueprints.brand.models import Brand from byceps.blueprints.party.models import Party from byceps.blueprints.shop.models.article import Article from byceps.blueprints.shop.models.order import Order, OrderItem, \ PaymentState as OrderPaymentState from byceps.blueprints.user.models import User, UserDetail from byceps.database import db from byceps.util.system import get_config_env_name_from_env environment = get_config_env_name_from_env(default='development') app = create_app(environment) init_app(app) if app.debug: exports = { '/users/avatars': str(app.config['PATH_USER_AVATAR_IMAGES']), } path_content = app.config.get('PATH_CONTENT') if path_content: exports['/content'] = str(path_content) app.wsgi_app = SharedDataMiddleware(app.wsgi_app, exports) from flask_debugtoolbar import DebugToolbarExtension app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False toolbar = DebugToolbarExtension(app)
from byceps.services.shop.article.models.article import Article from byceps.services.shop.order.models.order import Order from byceps.services.shop.order.models.order_item import OrderItem from byceps.services.shop.order.models.payment import \ PaymentState as OrderPaymentState from byceps.services.shop.order.service import find_order_by_order_number from byceps.services.ticketing.ticket_service import find_ticket_by_code from byceps.services.user.models.detail import UserDetail from byceps.services.user.models.user import User from byceps.services.user.service import find_user_by_screen_name from byceps.util.system import get_config_filename_from_env_or_exit config_filename = get_config_filename_from_env_or_exit() app = create_app(config_filename) init_app(app) @app.shell_context_processor def extend_shell_context(): """Provide common objects to make available in the application shell.""" return { 'app': app, 'db': db, 'Article': Article, 'Brand': Brand, 'find_order_by_order_number': find_order_by_order_number, 'Order': Order, 'OrderItem': OrderItem, 'OrderPaymentState': OrderPaymentState, 'Party': Party,