Skip to content

Commit

Permalink
Merge pull request #163 from stuartmaxwell:debugging-app
Browse files Browse the repository at this point in the history
Debugging-app
  • Loading branch information
stuartmaxwell authored Nov 28, 2024
2 parents c6b5fa2 + 4aac717 commit 557d321
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
RESEND_API_KEY=(str, ""),
CONTACT_FORM_TO=(str, ""),
CONTACT_FORM_FROM=(str, ""),
DEBUGGING_APP_PATH=(str, "this-is-just-a-temporary-debugging-app-path"),
)

environ.Env.read_env(Path(BASE_DIR / ".env"))
Expand Down Expand Up @@ -78,6 +79,7 @@
"spf_generator",
"contact_form",
"home",
"debugging_app",
]

if DEBUG:
Expand Down Expand Up @@ -306,3 +308,6 @@
SECURE_HSTS_SECONDS = 31536000 # 1 year
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True

# Debugging app
DEBUGGING_APP_PATH = env("DEBUGGING_APP_PATH")
1 change: 1 addition & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
path("utils/markdown-editor/", view=include("markdown_editor.urls")),
path("utils/spf/", view=include("spf_generator.urls")),
path("utils/home/", view=include("home.urls")),
path("utils/__debugging__/", view=include("debugging_app.urls")),
path("robots.txt", TemplateView.as_view(template_name="robots.txt", content_type="text/plain")),
path("sitemap.xml", sitemap, {"sitemaps": sitemaps}, name="django.contrib.sitemaps.views.sitemap"),
path("", include("djpress.urls")),
Expand Down
1 change: 1 addition & 0 deletions debugging_app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Debugging app."""
10 changes: 10 additions & 0 deletions debugging_app/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""App configuration for debugging_app."""

from django.apps import AppConfig


class DebuggingAppConfig(AppConfig):
"""App configuration."""

default_auto_field = "django.db.models.BigAutoField"
name = "debugging_app"
Empty file.
14 changes: 14 additions & 0 deletions debugging_app/templates/debugging_app/debugging.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% extends "base.html" %}
{% load static %}

{% block title %}Debugging App{% endblock %}

{% block content %}

<h1>Debugging App</h1>
<div class="highlight">
<pre><code style="padding: 0">{% for key, value in request.META.items %}<span class="k">{{ key }}</span><span class="p">: </span><span class="s2">{{ value }}</span>
{% endfor %}</code></pre>
</div>

{% endblock content %}
12 changes: 12 additions & 0 deletions debugging_app/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""URLs for debugging app."""

from django.conf import settings
from django.urls import path

from debugging_app.views import debugging_app

app_name = "debugging_app"

urlpatterns = [
path(settings.DEBUGGING_APP_PATH, debugging_app, name="debugging_app"),
]
10 changes: 10 additions & 0 deletions debugging_app/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""Views for the debugging_app app."""

from django.http import HttpRequest, HttpResponse
from django.shortcuts import render


def debugging_app(request: HttpRequest) -> HttpResponse:
"""View function for the debugging page."""
context = {"meta": request.META}
return render(request, "debugging_app/debugging.html", context)
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ sync-up:

# Run the Django development server
run:
{{uvr}} manage.py runserver

# Run the Django development server
arun:
{{uvr}} gunicorn --workers=2 --worker-class uvicorn_worker.UvicornWorker --bind 127.0.0.1:8000 config.asgi:application

# Make migrations
Expand Down

0 comments on commit 557d321

Please sign in to comment.