Fixed initial DB creation

This commit is contained in:
J. Fernando Sánchez 2015-08-26 12:44:56 +02:00
parent 322d9992fc
commit 497ae8973e

View File

@ -26,9 +26,6 @@ with app.app_context():
app.iniconfig.read(config_path)
# Build a sample db on the fly, if one does not exist yet.
app_dir = os.path.realpath(os.path.dirname(__file__))
database_path = os.path.join(app_dir, app.config['DATABASE_FILE'])
if not os.path.exists(database_path):
build_sample_db()
print app.config["SECURITY_POST_LOGIN_VIEW"]
# Define models
@ -198,6 +195,9 @@ videoadmin = VideoAdmin()
admin.add_view(videoadmin)
if __name__ == '__main__':
database_path = os.path.join(app_dir, app.config['DATABASE_FILE'])
if not os.path.exists(database_path):
build_sample_db()
app.run(host=app.config.get("HOST", "localhost"),
port=app.config.get("PORT", 5000),
debug=True)