def setUpClass(cls):
        '''Set up fixtures for the class.

        This methods runs once for the entire class. This test case do not
        insert or update any record on the database, so there is no problem
        to be run only once for the class.

        This way it save some time, instead of populate the test database
        each time a test is executed.
        '''
        admin = create_admin()
        app = create_app(config='quokka.test_settings',
                         DEBUG=False,
                         test=True,
                         admin_instance=admin)

        with app.app_context():
            db = list(app.extensions.get('mongoengine').keys())[0]
            db.connection.drop_database('quokka_test')
            from quokka.utils.populate import Populate
            Populate(db)()
        cls.app = app
        cls.db = db
コード例 #2
0
    def setUpClass(cls):
        '''Set up fixtures for the class.

        This methods runs once for the entire class. This test case do not
        insert or update any record on the database, so there is no problem
        to be run only once for the class.

        This way it save some time, instead of populate the test database
        each time a test is executed.
        '''
        admin = create_admin()
        app = create_app(config='quokka.test_settings',
                         DEBUG=False,
                         test=True,
                         admin_instance=admin)

        with app.app_context():
            db = list(app.extensions.get('mongoengine').keys())[0]
            db.connection.drop_database('quokka_test')
            from quokka.utils.populate import Populate
            Populate(db)()
        cls.app = app
        cls.db = db
コード例 #3
0
ファイル: manage.py プロジェクト: a373983267/quokka
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from flask.ext.script import Manager, Server
from flask.ext.collect import Collect
from quokka import create_app
from quokka.core.db import db
from quokka.ext.blueprints import load_blueprint_commands

app = create_app()
manager = Manager(app)
manager.add_option("-c", "--config",
                   dest="config", required=False,
                   default='quokka.settings')

collect = Collect()
collect.init_script(manager)


@manager.shell
def make_shell_context():
    " Update shell. "
    return dict(app=app, db=db)


@manager.command
def check():
    """Prints app status"""
    from pprint import pprint
    print("Extensions.")
    pprint(app.extensions)
コード例 #4
0
ファイル: conftest.py プロジェクト: Cetids/quokka
def app():
    app = create_app(config='quokka.test_settings',
                     DEBUG=False,
                     test=True,
                     mode='test')
    return app
コード例 #5
0
ファイル: wsgi_gunicorn.py プロジェクト: mfer/quokka
see this post
http://www.onurguzel.com/
how-to-run-flask-applications-with-nginx-using-gunicorn/
"""

import argparse
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from werkzeug.contrib.fixers import ProxyFix
from quokka import create_app, create_api
from quokka.utils.paas import activate

# If running on PAAS such as OpenShift or heroku may require venv activation
activate()

application = DispatcherMiddleware(create_app(), {'/api': create_api()})

application.wsgi_app = ProxyFix(application.app.wsgi_app)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
    parser.add_argument('-p', '--port', help='App Port')
    parser.add_argument('-i', '--host', help='App Host')
    parser.add_argument('-r',
                        '--reloader',
                        action='store_true',
                        help='Turn reloader on')
    parser.add_argument('-d',
                        '--debug',
                        action='store_true',
                        help='Turn debug on')
コード例 #6
0
import sys
if len(sys.argv) > 1 and sys.argv[1] == "-r":
    reloader = True
else:
    reloader = False

from quokka import create_app
app = create_app()
app.run(use_reloader=reloader)
コード例 #7
0
def app():
    app = create_app(config='quokka.test_settings',
                     DEBUG=False,
                     test=True,
                     mode='test')
    return app
コード例 #8
0
 def create_app(self):
     self.admin = create_admin()
     return create_app(config='quokka.test_settings',
                       DEBUG=False,
                       test=True,
                       admin_instance=self.admin)
コード例 #9
0
 def create_app(self):
     return create_app(config='quokka.test_settings',
                       DEBUG=False,
                       test=True)
コード例 #10
0
ファイル: test_basic.py プロジェクト: GraphGrail/quokka
 def create_app(self):
     self.admin = create_admin()
     return create_app(config='quokka.test_settings',
                       DEBUG=False,
                       test=True,
                       admin_instance=self.admin)
コード例 #11
0
#!/usr/bin/python

import argparse
from werkzeug.serving import run_simple
from quokka import create_app

application = app = create_app(ADMIN_REQUIRES_LOGIN=True)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
    parser.add_argument('-p', '--port', help='App Port')
    parser.add_argument('-i', '--host', help='App Host')
    parser.add_argument('-r',
                        '--reloader',
                        action='store_true',
                        help='Turn reloader on')
    parser.add_argument('-d',
                        '--debug',
                        action='store_true',
                        help='Turn debug on')
    args = parser.parse_args()
    run_simple(
        args.host or '127.0.0.1',
        int(args.port) if args.port else 5000,
        application,
        use_reloader=args.reloader or False,
        use_debugger=args.debug or False,
    )
コード例 #12
0
def app():
    """Flask Pytest uses it"""
    os.chdir('quokka/project_template/')
    return create_app()
コード例 #13
0
ファイル: wsgi_gunicorn.py プロジェクト: tonnyhjw/FlaskPyCMS
# -*- coding: utf-8 -*-

from werkzeug.serving import run_simple
from werkzeug.contrib.fixers import ProxyFix
from quokka import create_app

application = create_app()

application.wsgi_app = ProxyFix(application.wsgi_app)
"""
see this post
http://www.onurguzel.com/
how-to-run-flask-applications-with-nginx-using-gunicorn/
"""

if __name__ == "__main__":
    run_simple('0.0.0.0',
               5000,
               application,
               use_reloader=True,
               use_debugger=True)
コード例 #14
0
# -*- coding: utf-8 -*-

from werkzeug.serving import run_simple
from werkzeug.contrib.fixers import ProxyFix
from quokka import create_app

application = create_app()

application.wsgi_app = ProxyFix(application.wsgi_app)

"""
see this post
http://www.onurguzel.com/
how-to-run-flask-applications-with-nginx-using-gunicorn/
"""

if __name__ == "__main__":
    run_simple(
        '0.0.0.0',
        5000,
        application,
        use_reloader=True,
        use_debugger=True
    )
コード例 #15
0
ファイル: wsgi.py プロジェクト: AquaBindi/quokka
#!/usr/bin/python

import argparse
from werkzeug.serving import run_simple
from quokka import create_app

application = app = create_app(ADMIN_REQUIRES_LOGIN=True)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
    parser.add_argument('-p', '--port', help='App Port')
    parser.add_argument('-i', '--host', help='App Host')
    parser.add_argument('-r', '--reloader', action='store_true',
                        help='Turn reloader on')
    parser.add_argument('-d', '--debug', action='store_true',
                        help='Turn debug on')
    args = parser.parse_args()
    run_simple(
        args.host or '127.0.0.1',
        int(args.port) if args.port else 5000,
        application,
        use_reloader=args.reloader or False,
        use_debugger=args.debug or False,
    )
コード例 #16
0
ファイル: wsgi.py プロジェクト: Cetids/quokka
#!/usr/bin/python

import argparse
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from quokka import create_app, create_api
from quokka.utils.paas import activate

application = DispatcherMiddleware(create_app(), {
    '/api': create_api()
})

application = app = activate(application)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
    parser.add_argument('-p', '--port', help='App Port')
    parser.add_argument('-i', '--host', help='App Host')
    parser.add_argument('-r', '--reloader', action='store_true',
                        help='Turn reloader on')
    parser.add_argument('-d', '--debug', action='store_true',
                        help='Turn debug on')
    args = parser.parse_args()
    run_simple(
        args.host or '0.0.0.0',
        int(args.port) if args.port else 5000,
        application,
        use_reloader=args.reloader or False,
        use_debugger=args.debug or False,
    )
コード例 #17
0
#!/usr/bin/python
"""
see this post
http://www.onurguzel.com/
how-to-run-flask-applications-with-nginx-using-gunicorn/
"""

import argparse
from werkzeug.serving import run_simple
from werkzeug.wsgi import DispatcherMiddleware
from werkzeug.contrib.fixers import ProxyFix
from quokka import create_app, create_api
from quokka.utils.paas import activate


application = DispatcherMiddleware(create_app(), {
    '/api': create_api()
})

application.wsgi_app = ProxyFix(application.app.wsgi_app)

application = app = activate(application)

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run Quokka App for WSGI")
    parser.add_argument('-p', '--port', help='App Port')
    parser.add_argument('-i', '--host', help='App Host')
    parser.add_argument('-r', '--reloader', action='store_true',
                        help='Turn reloader on')
    parser.add_argument('-d', '--debug', action='store_true',
                        help='Turn debug on')