~homeworkprod/byceps

de023f8105ac558ffb1cf3b5e83ef9f192b2caab — Jochen Kupperschmidt 4 years ago 39f5c04
Inline module `byceps.application_factory`
3 files changed, 24 insertions(+), 23 deletions(-)

D byceps/application_factory.py
M manage.py
M serve.py
D byceps/application_factory.py => byceps/application_factory.py +0 -21
@@ 1,21 0,0 @@
# -*- coding: utf-8 -*-

"""
application factory
~~~~~~~~~~~~~~~~~~~

Create and initialize the application using a configuration specified by
an environment variable.

:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

from .application import create_app, init_app
from .util.system import get_config_filename_from_env


config_filename = get_config_filename_from_env()

app = create_app(config_filename)
init_app(app)

M manage.py => manage.py +8 -1
@@ 17,7 17,7 @@ from flask_script import Manager
from flask_script.commands import Server
from werkzeug.wsgi import SharedDataMiddleware

from byceps.application_factory import app
from byceps.application import create_app, init_app
from byceps.database import db
from byceps.services.brand.models import Brand
from byceps.services.party.models import Party


@@ 27,6 27,13 @@ from byceps.services.shop.order.models import Order, OrderItem, \
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


config_filename = get_config_filename_from_env()

app = create_app(config_filename)
init_app(app)


def _assemble_exports():

M serve.py => serve.py +16 -1
@@ 1,9 1,24 @@
# -*- coding: utf-8 -*-

"""
Create and initialize the application using a configuration specified by
an environment variable.

:Copyright: 2006-2016 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

import sys

from byceps.application import create_app, init_app
from byceps.util.system import get_config_filename_from_env


try:
    from byceps.application_factory import app
    config_filename = get_config_filename_from_env()
except Exception as e:
    sys.stderr.write("{}\n".format(e))
    sys.exit()

app = create_app(config_filename)
init_app(app)