Пример #1
0
def app():
    """An application for the tests."""
    _app = create_app(TestConfig)
    ctx = _app.test_request_context()
    ctx.push()

    yield _app

    ctx.pop()
Пример #2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from flask_server.app import create_app

if __name__ == '__main__':
    app = create_app()
Пример #3
0
def app():
    return create_app(TestConfig)
Пример #4
0
from invoke import task

from flask_server.app import create_app
from flask_server.config import ProdConfig
from flask_server.ext import freezer

try:
    from fabfile import HOST, PORT, USERNAME, PASSWORD
except ModuleNotFoundError:
    HOST, PORT, USERNAME, PASSWORD = '', '', '', ''
connect = Connection(HOST,
                     user=USERNAME,
                     port=PORT,
                     connect_kwargs={'password': PASSWORD})
DEPLOY_DIR = '/home/www/flask-vue-cms'
prod_app = create_app(ProdConfig)


@task
def deploy(c):
    pull_res = connect.run('cd ' + DEPLOY_DIR + ' && git pull')
    print(pull_res)
    stop_service = connect.sudo(
        'supervisorctl -c /etc/supervisord.conf stop cms')
    print(stop_service)
    start_service = connect.sudo(
        'supervisorctl -c /etc/supervisord.conf start cms')
    print(start_service)


@task
Пример #5
0
def test_production_config():
    """Production config."""
    app = create_app(ProdConfig)
    assert app.config['ENV'] == 'prod'
    assert app.config['DEBUG'] is False
Пример #6
0
def test_dev_config():
    """Development config."""
    app = create_app(DevelopConfig)
    assert app.config['ENV'] == 'dev'
    assert app.config['DEBUG'] is True
Пример #7
0
import sys

from flask_server import app
import logging



application = app.create_app()



def main():
    
    host = '0.0.0.0' if len(sys.argv) <= 1 else sys.argv[1]
    application.run(host=host, port='12345', debug=True, threaded=True,
                    ssl_context=('certificates/cert.pem',
                                 'certificates/key.pem'))

if __name__ == '__main__':
    log_handler = logging.FileHandler('flask_server.log')
    log_handler.setLevel(logging.DEBUG)
    logging.getLogger('werkzeug').addHandler(log_handler)

    application.logger.addHandler(log_handler)
    application.logger.setLevel(logging.DEBUG)
    main()