diff options
author | Frederick Muriuki Muriithi | 2022-08-31 03:27:28 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-08-31 03:27:28 +0300 |
commit | 215f4e07ccb7cef5db2c50d322a28576e2b9fd68 (patch) | |
tree | d32b3c61d70c9f5311270309af361cd0f46f4ed1 /wsgi.py | |
parent | 19c376c4b60592f4bba0e26952faa3a71b6f5641 (diff) | |
download | gn-uploader-215f4e07ccb7cef5db2c50d322a28576e2b9fd68.tar.gz |
Check connections outside app factory
Check the connections in the wsgi.py file, outside of the `create_app`
application factory to avoid issues with tests failing due to test app
not initialising because of missing connections in the test
environment.
Diffstat (limited to 'wsgi.py')
-rw-r--r-- | wsgi.py | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,8 +1,19 @@ """Run the application""" from qc_app import create_app, instance_path +from qc_app.check_connections import check_db, check_redis -app = create_app(instance_path()) +def check_and_build_app(): + # Setup the app + appl = create_app(instance_path()) + + # Check connections + check_db(appl.config["SQL_URI"]) + check_redis(appl.config["REDIS_URL"]) + return appl + +app = check_and_build_app() if __name__ == "__main__": + # Run the app app.run() |