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()
def initdb_command(): """Initializes the database using the command line.""" # TODO: prevent this from being done on production initdb() print('Initialized the database.')
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()