Esempio n. 1
0
from flask_script import Manager  # class for handling a set of commands
from flask_migrate import Migrate, MigrateCommand
from api.utils.factory import create_app
from api.utils.database import db
from api.utils.config import DevelopmentConfig

app = create_app(DevelopmentConfig)

migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()
Esempio n. 2
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

from api.utils.factory import create_app
from api.utils.config import DevelopmentConfig, ProductionConfig
import os

if __name__ == '__main__':
    if os.environ.get('WORK_ENV') == 'DEBUG':
        app = create_app(DevelopmentConfig)
        app.run(port=8080,
                host="0.0.0.0",
                use_reloader=True,
                use_debugger=True,
                debug=True)
    else:
        app = create_app(ProductionConfig)
        app.run(port=8080, host="0.0.0.0", use_reloader=False)
Esempio n. 3
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
from api.utils.factory import create_app
from os import environ

if __name__ == '__main__':
    app = create_app()
    port_run = environ.get("PORT", 5000)
    if os.environ.get('WORK_ENV') == 'PROD':
        app.run(port=port_run, host="0.0.0.0", use_reloader=False)
    else:
        app.run(port=port_run, host="0.0.0.0", use_reloader=True)
Esempio n. 4
0
import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand

from api.utils.database import db
from api.utils.factory import create_app
from api import models
app = create_app(config_name=os.getenv('APP_SETTING'))

migrate = Migrate(app, db)
manager = Manager(app)

manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()
Esempio n. 5
0
 def setUp(self):
     app = create_app(TestingConfig)
     app.app_context().push()
     self.app = app.test_client()
Esempio n. 6
0
    if 'IP_ADDRESS' in os.environ:
        print('Setting host IP address to {}'.format(os.environ.get('IP_ADDRESS')))
        settings['IP_ADDRESS'] = os.environ.get('IP_ADDRESS')

    if 'PORT' in os.environ:
        print('Setting host PORT to {}'.format(os.environ.get('PORT')))
        settings['PORT'] = os.environ.get('PORT')

    if 'DEVTEST_CONF' in os.environ:

        config = os.environ.get('DEVTEST_CONF')

        print('Reading configuration set {}'.format(config))

        if config in ['PROD', 'PRODUCTION']:
            app = create_app(ProductionConfig)
            app.run(port=settings['PORT'], host=settings['IP_ADDRESS'],
                    use_reloader=ProductionConfig.USE_RELOADER)
        elif config in ['DEV', 'DEVEL', 'DEVELOPMENT']:
            app = create_app(DevelopmentConfig)
            app.run(port=settings['PORT'], host=settings['IP_ADDRESS'],
                    use_reloader=DevelopmentConfig.USE_RELOADER)
        elif config in ['TEST', 'TESTING']:
            app = create_app(TestingConfig)
            app.run(port=settings['PORT'], host=settings['IP_ADDRESS'],
                    use_reloader=TestingConfig.USE_RELOADER)
        elif config == 'SQLITE':
            app = create_app(SqlLiteDevelopmentConfig)
            app.run(port=settings['PORT'], host=settings['IP_ADDRESS'],
                    use_reloader=SqlLiteDevelopmentConfig.USE_RELOADER)
Esempio n. 7
0
import os
from api.utils.factory import create_app

config_name = os.getenv('APP_SETTINGS', 'default')
app = create_app(config_name)

if __name__ == '__main__':
    app.run()