def main():
    app = create_app(get_config(os.getenv('FLASK_ENV') or 'dev'))

    with app.app_context():

        metric = models.Metric('prop1', datetime(2016, 11, 5))
        metric.save()

        metric = models.Metric('prop2', datetime(2016, 11, 5), extra="foobar")
        metric.save()
def main():
    create_app(get_config(os.getenv('FLASK_ENV') or 'dev'))

    room = models.Foobar()
Пример #3
0
def app():
    app = create_app(get_config('test'))
    app.testing = True
    return app
Пример #4
0
def app():
    return create_app(get_config('test'))
Пример #5
0
#!env/bin/python

import os

from flask_script import Manager, Server

from dwellingplace.settings import get_config
from dwellingplace.app import create_app


def find_assets():
    """Yield paths for all static files and templates."""
    for name in ['static', 'templates']:
        directory = os.path.join(app.config['PATH'], name)
        for entry in os.scandir(directory):
            if entry.is_file():
                yield entry.path


config = get_config(os.getenv('FLASK_ENV'))

app = create_app(config)

server = Server(host='0.0.0.0', extra_files=find_assets())

manager = Manager(app)
manager.add_command('run', server)

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