Browse Source

Fixed OperationalError when creating the database

Harro van der Klauw 11 years ago
parent
commit
662189eb79
1 changed files with 8 additions and 3 deletions
  1. 8 3
      flaskbb/app.py

+ 8 - 3
flaskbb/app.py

@@ -15,6 +15,8 @@ import datetime
 from flask import Flask, request
 from flask.ext.login import current_user
 
+from sqlalchemy.exc import OperationalError
+
 # Import the user blueprint
 from flaskbb.user.views import user
 from flaskbb.user.models import User, Guest, PrivateMessage
@@ -134,9 +136,12 @@ def configure_extensions(app):
 
 
 def update_settings_from_db(app):
-    if not app.config["TESTING"]:
-        with app.app_context():
-            app.config.update(Setting.as_dict(upper=True))
+    try:
+        if not app.config["TESTING"]:
+            with app.app_context():
+                app.config.update(Setting.as_dict(upper=True))
+    except OperationalError:
+        pass
 
 
 def configure_template_filters(app):