コード例 #1
0
    def setUp(self):
        super().setUp()

        register_config(StoqConfig())
        app = bootstrap_app()
        app.testing = True
        self.client = app.test_client()
コード例 #2
0
def b1food_client(current_user, current_station):
    app = bootstrap_app()
    db_fd, app.config['DATABASE'] = tempfile.mkstemp()
    app.config['TESTING'] = True
    app.test_client_class = B1foodTestClient
    with app.test_client() as client:
        with app.app_context():
            client.user = current_user
            client.station = current_station
            yield client

    os.close(db_fd)
    os.unlink(app.config['DATABASE'])
コード例 #3
0
#
"""

run with:

    gunicorn stoqserver.gunicorn -w 4 -b localhost:6971 -k gevent

"""

from stoqserver import activate_virtualenv
activate_virtualenv()

# This needs to be done ASAP, before any other imports.
from gevent import monkey
from psycogreen.gevent import patch_psycopg
monkey.patch_all()
patch_psycopg()

import stoq
from stoqserver import app
from stoqserver.main import setup_stoq, setup_logging

import sys
# sys.argv comes with the arguments passed to gunicorn, but stoq will not work well with those.
sys.argv = []

setup_stoq(register_station=True, name='stoqflask', version=stoq.version)
setup_logging(app_name='stoq-flask')

application = app.bootstrap_app(debug=False, multiclient=True)