Fixed initial DB creation
This commit is contained in:
parent
322d9992fc
commit
497ae8973e
@ -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
|
||||||
@ -170,7 +167,7 @@ class VideoAdmin(fileadmin.FileAdmin):
|
|||||||
if not op.exists(path):
|
if not op.exists(path):
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def base_dir(self):
|
def base_dir(self):
|
||||||
return app.iniconfig.get("directory", "path")
|
return app.iniconfig.get("directory", "path")
|
||||||
@ -186,7 +183,7 @@ class VideoAdmin(fileadmin.FileAdmin):
|
|||||||
|
|
||||||
def on_edit_file(self, *args, **kwargs):
|
def on_edit_file(self, *args, **kwargs):
|
||||||
self.update_base()
|
self.update_base()
|
||||||
|
|
||||||
def on_file_delete(self, *args, **kwargs):
|
def on_file_delete(self, *args, **kwargs):
|
||||||
self.update_base()
|
self.update_base()
|
||||||
|
|
||||||
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user