Skip to content
This repository was archived by the owner on Dec 19, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
SECRET_KEY='dwellingly'
PYTHONPATH=${PWD}:${PYTHONPATH}

# To set the database to postgresql. Uncomment the env vars below
## Uncomment to see logging from sqlalchemy
# DB_LOGGING=ON

## To set the database to postgresql. Uncomment the env vars below
# DEV_DATABASE_URL=postgresql://localhost/dwellingly_development
# TEST_DATABASE_URL=postgresql://localhost/dwellingly_test
7 changes: 5 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import logging
from flask import Flask
from flask_jwt_extended import JWTManager
Expand Down Expand Up @@ -55,8 +56,10 @@ def check_if_token_in_blocklist(jwt_header, decrypted_token):
def format_unauthorized_message(message):
return {app.config["JWT_ERROR_MESSAGE_KEY"]: message.capitalize()}, 401

logging.basicConfig()
logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO)
if os.getenv("DB_LOGGING") == "ON":
logging.basicConfig()
logging.getLogger("sqlalchemy.engine").setLevel(logging.INFO)

db.init_app(app)
ma.init_app(app)
return app