Exemplo n.º 1
0
    import model
    import bottle

    if os.environ.get('GATEWAY_INTERFACE'):
        #  Called from CGI
        app = website.build_application()
        bottle.run(app, server=bottle.CGIServer)
        sys.exit(0)

    if 'test-server' in sys.argv[1:]:
        'Run stand-alone test server'
        sys.path.append('tests')

        if os.environ.get('DBCREDENTIALSTR') == 'sqlite:///:memory:':
            model.initdb()
            model.create_sample_data()
        app = website.build_application()

        bottle.debug(True)
        bottle.run(app, reloader=True, host='127.0.0.1', port=8080)
        sys.exit(0)

    if 'initdb' in sys.argv[1:]:
        'Run database initialization'
        model.initdb()
        sys.exit(0)

    if 'load-test-data' in sys.argv[1:]:
        'Load test data-set'
        model.create_sample_data()
Exemplo n.º 2
0
def initdb_command():
    """Initializes the database using the command line."""
    # TODO: prevent this from being done on production
    initdb()
    print('Initialized the database.')
Exemplo n.º 3
0
from ___init__ import app
from api import auth
from config import Config
from model import initdb

app.config.from_object(Config)
app.register_blueprint(auth.bp)
initdb(app)


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