Beispiel #1
0
"""Entry point for launching the app"""
from app import build_app

if __name__ == "__main__":
    build_app().run('localhost', port=5000, debug=True)
Beispiel #2
0
from app import build_app

dlg = build_app()
from app import build_app

app = build_app()

if __name__ == '__main__':
    app.run(debug=True, host="0.0.0.0", port=5000)
Beispiel #4
0
 def __init__(self, *args, **kwargs):
         super(RequestHandlersTestCase, self).__init__(*args, **kwargs)
         self._factory = make_session_factory(sqlite_url)
         self._application = build_app()
Beispiel #5
0
async def test_get():
    app = build_app()
    response = await app.test_client().get('/total')
    assert await response.json == {'total': 500000500000}
Beispiel #6
0
import os
from flask import render_template
from app import build_app


DEBUG = 'PROD' not in os.environ
PORT = os.environ.get('PORT', 5000)

app = build_app(__name__)

@app.route("/")
def home():
	return render_template("main.html")

@app.route("/error/<int:code>")
def error(code):
	if code == 500:
		return render_template('500.html'), 500
	return render_template('404.html'), 404

@app.route("/es")
def home_es():
    return render_template("es/main.html")

@app.errorhandler(500)
def internal_server_error(e):
    return render_template('500.html'), 500

@app.errorhandler(404)
def internal_server_error(e):
    return render_template('404.html'), 404
Beispiel #7
0
        # except:
        #     pass
    with _app.open_resource('../sql/stored_functions.sql', mode='r') as f:
        connection.cursor().execute(f.read())

    with _app.open_resource('../sql/stored_functions_statistics.sql',
                            mode='r') as f:
        connection.cursor().execute(f.read())

    with _app.open_resource('../sql/test.sql', mode='r') as f:
        connection.cursor().execute(f.read())

    connection.commit()
    print(' * Database has been successfully recreated')
    connection.close()


if __name__ == '__main__':

    # Resolving config name
    # If you need not default config - just set environment variable FLASK_CONFIG to 'production'
    # os.environ['FLASK_CONFIG'] = 'production'
    config_name = os.getenv('FLASK_CONFIG', 'development')
    print(" * Loading configuration %s" % config_name)

    # Building and run the Flask application
    app = build_app(config_name)
    if config_name.lower() == 'development':
        drop_create_db(app)
    app.run()
Beispiel #8
0
def app_server():
    app = build_app()
    server = make_server('', 8080, app)
    server.serve_forever()