Skip to content

Commit

Permalink
Merge branch 'main' into fmd-765-automate-issue-creation-for-dependab…
Browse files Browse the repository at this point in the history
…ot-pr
  • Loading branch information
mitchdawson1982 authored Sep 9, 2024
2 parents 0e6db94 + 0d450c2 commit d001697
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 51 deletions.
13 changes: 11 additions & 2 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
pass

# Application definition
INSTALLED_APPS = [
INSTALLED_APPS: list[str] = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
Expand All @@ -46,10 +46,14 @@
"waffle",
]

INTERNAL_IPS: list[str] = [
"127.0.0.1",
]

if os.environ.get("AZURE_AUTH_ENABLED", "true") != "false":
INSTALLED_APPS.append("azure_auth")

MIDDLEWARE = [
MIDDLEWARE: list[str] = [
"django_prometheus.middleware.PrometheusBeforeMiddleware",
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
Expand Down Expand Up @@ -224,6 +228,11 @@
environment=ENV or "local",
)

# add debug toolbar when not running tests
if DEBUG and not TESTING:
INSTALLED_APPS.insert(-1, "debug_toolbar")
MIDDLEWARE.insert(1, "debug_toolbar.middleware.DebugToolbarMiddleware")

# Enable / Disable Azure Auth
if not os.environ.get("AZURE_AUTH_ENABLED", "true") == "false":
# Adds the Azure Authentication middleware to the Django Authentication middleware
Expand Down
7 changes: 7 additions & 0 deletions core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from debug_toolbar.toolbar import debug_toolbar_urls
from django.conf import settings
from django.urls import include, path

app_name = "core"
Expand All @@ -26,4 +28,9 @@
path("", include("django_prometheus.urls")),
]

if settings.DEBUG and not settings.TESTING:
urlpatterns = [
*urlpatterns,
] + debug_toolbar_urls()

handler404 = "core.views.handler404"
19 changes: 17 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ django-azure-auth = "2.0.2"
django-waffle = "^4.1.0"
psycopg = "^3.2.1"
psycopg-binary = "^3.2.1"
django-debug-toolbar = "^4.4.6"
redis = {extras = ["hiredis"], version = "^5.0.8"}

[tool.poetry.group.dev.dependencies]
Expand Down
12 changes: 4 additions & 8 deletions templates/400.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@

{% block content %}

<div class="govuk-width-container">
<main class="govuk-main-wrapper govuk-main-wrapper--l" id="main-content" role="main">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">{{h1_value}}</h1>
</div>
</div>
</main>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">{{h1_value}}</h1>
</div>
</div>

{% endblock content %}
24 changes: 10 additions & 14 deletions templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@

{% block content %}

<div class="govuk-width-container">
<main class="govuk-main-wrapper govuk-main-wrapper--l" id="main-content" role="main">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">{{h1_value}}</h1>
<p class="govuk-body">
{% translate "If you typed the web address, check it is correct." %}
</p>
<p class="govuk-body">
{% translate "If you pasted the web address, check you copied the entire address." %}
</p>
</div>
</div>
</main>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">{{h1_value}}</h1>
<p class="govuk-body">
{% translate "If you typed the web address, check it is correct." %}
</p>
<p class="govuk-body">
{% translate "If you pasted the web address, check you copied the entire address." %}
</p>
</div>
</div>

{% endblock content %}
20 changes: 8 additions & 12 deletions templates/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@

{% block content %}

<div class="govuk-width-container">
<main class="govuk-main-wrapper govuk-main-wrapper--l" id="main-content" role="main">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">{{h1_value}}</h1>
<p class="govuk-body">
{% translate "There is a problem with the server." %}
</p>
{% include "partial/contact_team.html" %}
</div>
</div>
</main>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">{{h1_value}}</h1>
<p class="govuk-body">
{% translate "There is a problem with the server." %}
</p>
{% include "partial/contact_team.html" %}
</div>
</div>

{% endblock content %}
21 changes: 8 additions & 13 deletions templates/500_datahub_unavailable.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
{% load static %}

{% block content %}

<div class="govuk-width-container">
<main class="govuk-main-wrapper govuk-main-wrapper--l" id="main-content" role="main">
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">{{h1_value}}</h1>
<p class="govuk-body">
{% translate "The DataHub catalogue is currently unavailable. Please try again in a few minutes." %}
</p>
{% include "partial/contact_team.html" %}
</div>
</div>
</main>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">{{h1_value}}</h1>
<p class="govuk-body">
{% translate "The DataHub catalogue is currently unavailable. Please try again in a few minutes." %}
</p>
{% include "partial/contact_team.html" %}
</div>
</div>

{% endblock content %}
2 changes: 2 additions & 0 deletions templates/base/head.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load static %}
{% load page_title %}

<head>
<meta charset="utf-8">
<title>{{h1_value|render_title}}</title>
Expand All @@ -12,4 +13,5 @@
<link rel="manifest" href="{% static 'assets/manifest.json' %}">
<link rel="stylesheet" type="text/css" href="{% static 'assets/css/base.css' %}">
<meta property="og:image" content="{% static 'assets/images/govuk-opengraph-image.png' %}">
<meta name="robots" content="noindex, nofollow" />
</head>

0 comments on commit d001697

Please sign in to comment.