Fixed initial DB creation
This commit is contained in:
		| @@ -26,9 +26,6 @@ with app.app_context(): | |||||||
|     app.iniconfig.read(config_path) |     app.iniconfig.read(config_path) | ||||||
| # Build a sample db on the fly, if one does not exist yet. | # Build a sample db on the fly, if one does not exist yet. | ||||||
| app_dir = os.path.realpath(os.path.dirname(__file__)) | 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"] | print app.config["SECURITY_POST_LOGIN_VIEW"] | ||||||
| # Define models | # Define models | ||||||
| @@ -198,6 +195,9 @@ videoadmin = VideoAdmin() | |||||||
| admin.add_view(videoadmin) | admin.add_view(videoadmin) | ||||||
|  |  | ||||||
| if __name__ == '__main__': | 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"), |     app.run(host=app.config.get("HOST", "localhost"), | ||||||
|             port=app.config.get("PORT", 5000), |             port=app.config.get("PORT", 5000), | ||||||
|             debug=True) |             debug=True) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user