aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-04-12 12:01:01 +0300
committerFrederick Muriuki Muriithi2022-04-12 12:01:01 +0300
commit5930c92a8094e501bf2a3e9add18cb2eb4024044 (patch)
tree9610161e5ee9981306212ff8077b1edbeceab91f
parent21ef95965bda7304e485fbf9b3b55c7eb2c787b8 (diff)
downloadgenenetwork2-5930c92a8094e501bf2a3e9add18cb2eb4024044.tar.gz
Don't create db engine for static files
There is no need to create a database engine for requests for static files like CSS files and javascript files. This commit checks for and skips the creation of the engine for such requests.
-rw-r--r--wqflask/wqflask/views.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 1dd654df..2138146c 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -109,7 +109,7 @@ logger = utility.logger.getLogger(__name__)
@app.before_request
def connect_db():
db = getattr(g, '_database', None)
- if db is None:
+ if request.endpoint not in ("static", "js") and db is None:
g.db = g._database = sqlalchemy.create_engine(
SQL_URI, encoding="latin1")