Exemplo n.º 1
0
def app():
    app = create_app()
    yield app
Exemplo n.º 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Manage for flaskapp."""

import os

from flaskapp import create_app, db

from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand

app = create_app(os.getenv('FLASKAPP_ENV') or 'dev')
manager = Manager(app)

migrate = Migrate(app, db)

manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()
Exemplo n.º 3
0
from flaskapp import create_app

application = create_app(app_config='DEVELOPMENT')

if __name__ == '__main__':
    application.run()
Exemplo n.º 4
0
from flaskapp import create_app


app = create_app()


if __name__ == "__main__":
    from werkzeug.serving import run_simple

    run_simple('0.0.0.0',
               5000,
               app,
               threaded=True,
               use_reloader=True,
               use_debugger=True)
Exemplo n.º 5
0
def test_config():
    assert not create_app().testing
    assert create_app({'TESTING': True}).testing
Exemplo n.º 6
0
from flaskapp import create_app

if __name__ == '__main__':

    app = create_app(test_config=None)
    app.run(host='127.0.0.1', port=5000, debug=True)
Exemplo n.º 7
0
from flaskapp import create_app
import threading
from telegram_bot import updater


def flask_thread():
    print('flask thread starting:')
    flask.run('0.0.0.0')


def telegram_thread():
    updater.start_polling()


flask = create_app()


if __name__ == '__main__':
    t1 = threading.Thread(target=flask_thread, name='flask-thread')
    # # t3 = threading.Thread(target=telegram_thread)
    t1.start()

    t1.join()  # Main thread should be blocked


Exemplo n.º 8
0
from flask_migrate import Migrate
from flask_migrate import MigrateCommand
from flask_script import Manager

from flaskapp import create_app
from flaskapp import db
from flaskapp.config import DevelopmentConfig

app = create_app(config_class=DevelopmentConfig)
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command("db", MigrateCommand)

if __name__ == "__main__":
    manager.run()
Exemplo n.º 9
0
import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

from flaskapp import create_app
from flaskapp.meta import db

# create database tables
with create_app().app_context():
    db.create_all()
Exemplo n.º 10
0
def test_flask_sample():
    app = create_app()
    app.config['TESTING'] = True
    client = app.test_client()
    result = client.get('/')
    assert b'Hello, World' == result.data
Exemplo n.º 11
0
from flask_migrate import Migrate
from flask_migrate import MigrateCommand
from flask_script import Manager

from flaskapp import create_app
from flaskapp import db
from flaskapp.config import Config

app = create_app(config_class=Config)
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command("db", MigrateCommand)

if __name__ == "__main__":
    manager.run()
Exemplo n.º 12
0
import os
from flaskapp import create_app, mongodb

app = create_app(os.getenv("FLASK_CONFIG") or "default")

@app.shell_context_processor
def make_shell_context():
    return dict(mongodb=mongodb)
Exemplo n.º 13
0
from flaskapp import create_app, db

# Instantiating app to create_app class in __init__.py file
app = create_app()
app.app_context().push()

# Run Flask app in DEBUG MODE
if __name__ == '__main__':
    db.create_all(app=create_app())
    app.run(debug=True)
Exemplo n.º 14
0
from flaskapp import create_app

app = create_app()  # create app instance

# Run app only from within module (i.e. run.py)
if __name__ == "__main__":
    app.run(debug=True)
Exemplo n.º 15
0
 def setUp(self):
     self.app = create_app("config.TestingConfig")
     self.client = self.app.test_client()
Exemplo n.º 16
0
    def create_app(self):
        from flaskapp import create_app
        from flaskapp.config import TestConfig

        app = create_app(TestConfig)
        return app
Exemplo n.º 17
0
 def setUpClass(cls):
     app = create_app()
     app.app_context().push()
 def setUp(self):
     self.app = create_app()
Exemplo n.º 19
0
 def create_app(self):
     """Create Flask App."""
     return create_app('test')
Exemplo n.º 20
0
def create_wsgi() -> flask.Flask:
    auth_api = create_auth_api_client()
    resource_api = create_resource_api_client()
    http_handler = create_http_handler(auth_api, resource_api)
    return flaskapp.create_app(http_handler)
Exemplo n.º 21
0
import os
from flaskapp import create_app, db
from flaskapp.models import User, Role
from flask.ext.script import Manager, Shell
from flask.ext.migrate import Migrate, MigrateCommand

app = create_app(os.getenv('FLASK_CONFIG'))
#app = create_app(os.getenv('default'))
manager = Manager(app)
migrate = Migrate(app, db)


def make_shell_context():
    return dict(app=app, db=db, User=User, Role=Role)


manager.add_command("shell", Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()
Exemplo n.º 22
0
from flaskapp import create_app
from flaskapp.config import DevelopmentConfig

app = create_app(DevelopmentConfig)

# If we do not want to set all enviroment variables to run the server.
# We can wirte this code and run server using python command:
# python flaskblog.py
if __name__ == '__main__':
    app.run(debug=True)
Exemplo n.º 23
0
from flaskapp import create_app

app = create_app()
Exemplo n.º 24
0
import os
from flaskapp import create_app

app = create_app(os.getenv(FLASK_CONFIG, default="config.DevelopmentConfig"))
Exemplo n.º 25
0
from gevent import monkey
monkey.patch_all()
from flaskapp import create_app, socketio

app = create_app(True)

if __name__ == '__main__':
	socketio.run(app)
Exemplo n.º 26
0
def create_wsgi() -> flask.Flask:
    applications_repo = create_applications_repository()
    oauth2_service = create_oauth2_service(applications_repo)
    http_handler = create_http_handler(oauth2_service)
    return flaskapp.create_app(http_handler)