Skip to content

Commit

Permalink
Merge pull request #738 from jacebrowning/debug-config
Browse files Browse the repository at this point in the history
Make DEBUG configurable
  • Loading branch information
jacebrowning committed Aug 13, 2022
2 parents a09f867 + fb2102e commit 68e9d32
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"getbbox",
"getenv",
"getoffset",
"getplugin",
"gjpqy",
"Googlebot",
"Groupon",
Expand Down Expand Up @@ -66,6 +67,7 @@
"Panik",
"Philosoraptor",
"Photoshop",
"pluginmanager",
"podman",
"PYTHONASYNCIODEBUG",
"PYTHONUNBUFFERED",
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ promote: install .envrc
echo >> $@
echo "export CF_API_KEY=???" >> $@
echo "export REMOTE_TRACKING_URL=???" >> $@
echo "export DEBUG=true" >> $@
2 changes: 1 addition & 1 deletion Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
api: DEBUG=true PYTHONUNBUFFERED=1 PYTHONASYNCIODEBUG=1 python app/main.py
api: DEBUG="${DEBUG:-true}" PYTHONUNBUFFERED=1 PYTHONASYNCIODEBUG=1 python app/main.py
site: mkdocs serve --dev-addr localhost:5001
1 change: 1 addition & 0 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async def robots(request):
host="0.0.0.0",
port=5000,
debug=settings.DEBUG,
auto_reload=True,
access_log=False,
motd=False,
fast=True,
Expand Down
2 changes: 1 addition & 1 deletion app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Server configuration

DEBUG = bool(os.environ.get("DEBUG", False))
DEBUG = os.environ.get("DEBUG", "false") == "true"

if "DOMAIN" in os.environ: # staging / production
SERVER_NAME = os.environ["DOMAIN"]
Expand Down
1 change: 1 addition & 0 deletions app/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def pytest_configure(config):
terminal = config.pluginmanager.getplugin("terminal")
terminal.TerminalReporter.showfspath = False
settings.ALLOWED_EXTENSIONS.append("apng")
settings.DEBUG = False


def pytest_runtest_setup(item):
Expand Down

0 comments on commit 68e9d32

Please sign in to comment.