コード例 #1
0
def init(config_name):
    from importlib import import_module
    from freenit import create_app
    from config import configs
    from name import app_name

    app = import_module(f'{app_name}')
    config = configs[config_name]
    application = create_app(config)
    app.create_app(application)
    return application
コード例 #2
0
ファイル: application.py プロジェクト: tilda-center/backend
def init(config_name):
    from importlib import import_module
    from freenit import create_app
    from config import configs
    from name import app_name

    app = import_module(f'{app_name}')
    config = configs[config_name]
    application = create_app(
        config,
        schemas={
            'role': 'tilda.schemas.role',
            'user': '******',
        },
    )
    app.create_app(application)
    return application
コード例 #3
0
def app():
    config = configs['testing']
    flask_app = create_app(config)
    router = Router(
        flask_app.db.database,
        migrate_dir=f'{DEFAULT_MIGRATE_DIR}',
    )
    #  log_router = Router(
    #      flask_app.logdb.database,
    #      migrate_dir=f'{DEFAULT_MIGRATE_DIR}/logs',
    #  )
    router.run()
    #  log_router.run()
    yield flask_app
    flask_app.db.close_db('')
    #  flask_app.logdb.close_db('')
    current_path = os.path.dirname(__file__)
コード例 #4
0
ファイル: wsgi.py プロジェクト: astroshima/backend_tilda
import os
import socket
from importlib import import_module

from freenit import create_app

from config import configs
from name import app_name

api = import_module(f'{app_name}.api')
config_name = os.getenv('FLASK_ENV') or 'default'
config = configs[config_name]
app = create_app(config)
api.create_api(app)
hostname = socket.gethostname()
port = os.environ.get('FLASK_PORT', 5000)
REDOC_PATH = f'{config.OPENAPI_URL_PREFIX}{config.OPENAPI_REDOC_PATH}'
REDOC_URL = f'http://{hostname}:{port}{REDOC_PATH}'
SWAGGER_PATH = f'{config.OPENAPI_URL_PREFIX}{config.OPENAPI_SWAGGER_UI_PATH}'
SWAGGER_URL = f'http://{hostname}:{port}{SWAGGER_PATH}'

if __name__ == '__main__':
    print(' * ReDoc URL:', REDOC_URL)
    print(' * Swagger URL:', SWAGGER_URL)
    app.run(
        host='0.0.0.0',
        port=port,
        debug=True,
        use_reloader=True,
    )
コード例 #5
0
import os
import socket
from importlib import import_module

from freenit import create_app

from config import configs
from name import app_name

api = import_module(f'{app_name}.api')
config_name = os.getenv('FLASK_ENV') or 'default'
config = configs[config_name]
schemas = {
    'user': f'{app_name}.schemas.user',
}
application = create_app(config, schemas=schemas)
api.create_api(application)
hostname = socket.gethostname()
port = os.environ.get('FLASK_PORT', 5000)
SWAGGER_PATH = f'{config.OPENAPI_URL_PREFIX}{config.OPENAPI_SWAGGER_UI_PATH}'
SWAGGER_URL = f'http://{hostname}:{port}{SWAGGER_PATH}'

if __name__ == '__main__':
    print(' * Swagger URL:', SWAGGER_URL)
    application.run(
        host='0.0.0.0',
        port=port,
        debug=True,
        use_reloader=True,
    )
コード例 #6
0
ファイル: wsgi.py プロジェクト: ninjadevtrack/freenit-backend
from config import configs
from freenit import create_app

app = create_app(configs['testing'])

if __name__ == '__main__':
    app.run()
コード例 #7
0
import os
import socket
from importlib import import_module

from freenit import create_app

from config import configs
from name import app_name

api = import_module(f'{app_name}.api')
config_name = os.getenv('FLASK_ENV') or 'default'
config = configs[config_name]
application = create_app(config)
api.create_api(application)
hostname = socket.gethostname()
port = os.environ.get('FLASK_PORT', 5000)
SWAGGER_PATH = f'{config.OPENAPI_URL_PREFIX}{config.OPENAPI_SWAGGER_UI_PATH}'
SWAGGER_URL = f'http://{hostname}:{port}{SWAGGER_PATH}'

if __name__ == '__main__':
    print(' * Swagger URL:', SWAGGER_URL)
    application.run(
        host='0.0.0.0',
        port=port,
        debug=True,
        use_reloader=True,
    )
コード例 #8
0
ファイル: wsgi.py プロジェクト: Veskor/backend-2
from importlib import import_module

from freenit import create_app

from config import configs
from name import app_name
from tilda.cli import register

api = import_module(f'{app_name}.api')
config_name = os.getenv('FLASK_ENV') or 'default'
config = configs[config_name]
schemas = {
    'user': f'{app_name}.schemas.user',
    'role': f'{app_name}.schemas.role',
}
application = create_app(config, dbtype='sql', schemas=schemas)
api.create_api(application)
register(application)
hostname = socket.gethostname()
port = os.environ.get('FLASK_PORT', 5000)
SWAGGER_PATH = f'{config.OPENAPI_URL_PREFIX}{config.OPENAPI_SWAGGER_UI_PATH}'
SWAGGER_URL = f'http://{hostname}:{port}{SWAGGER_PATH}'

if __name__ == '__main__':
    print(' * Swagger URL:', SWAGGER_URL)
    application.run(
        host='0.0.0.0',
        port=port,
        debug=True,
        use_reloader=True,
    )
コード例 #9
0
ファイル: wsgi.py プロジェクト: Veskor/backend-1
import os
import socket

from config import configs
from freenit import create_app

config_name = os.getenv('FLASK_ENV') or 'default'
config = configs[config_name]
app = create_app(config, 'freenit')
hostname = socket.gethostname()
port = os.environ.get('FLASK_PORT', 5000)
REDOC_PATH = f'{config.OPENAPI_URL_PREFIX}{config.OPENAPI_REDOC_PATH}'
REDOC_URL = f'http://{hostname}:{port}{REDOC_PATH}'
SWAGGER_PATH = f'{config.OPENAPI_URL_PREFIX}{config.OPENAPI_SWAGGER_UI_PATH}'
SWAGGER_URL = f'http://{hostname}:{port}{SWAGGER_PATH}'

if __name__ == '__main__':
    print(' * ReDoc URL:', REDOC_URL)
    print(' * Swagger URL:', SWAGGER_URL)
    app.run(
        host='0.0.0.0',
        port=port,
        debug=True,
        use_reloader=True,
    )