Skip to content
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
18 changes: 18 additions & 0 deletions manage_breast_screening/assets/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,24 @@ a[href="#"] {
color: #c80000 !important;
}

// Environment banner at the top of the page
.app-environment {
@include nhsuk-font-size(14);
@include nhsuk-responsive-padding(2, bottom);
@include nhsuk-responsive-padding(2, top);

.nhsuk-link {
color: inherit;
}

.nhsuk-width-container {
align-items: baseline;
display: flex;
flex-wrap: wrap;
gap: nhsuk-spacing(1) nhsuk-spacing(2);
}
}

// Status tag positioning within headers
.app-header {
position: relative;
Expand Down
1 change: 1 addition & 0 deletions manage_breast_screening/config/jinja2_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def environment(**options):
"raise": raise_helper,
"static": static,
"url": reverse,
"DJANGO_ENV": settings.DJANGO_ENV,
}
)

Expand Down
6 changes: 4 additions & 2 deletions manage_breast_screening/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def list_env(key):

DJANGO_ENV = environ.get("DJANGO_ENV", "production")

IS_PRODUCTION = DJANGO_ENV == "production"

ALLOWED_HOSTS = list_env("ALLOWED_HOSTS")
CSRF_TRUSTED_ORIGINS = list_env("CSRF_TRUSTED_ORIGINS")

Expand Down Expand Up @@ -76,7 +78,7 @@ def list_env(key):
"ninja",
]

if DJANGO_ENV != "production":
if not IS_PRODUCTION:
INSTALLED_APPS.append("manage_breast_screening.nonprod")

MIDDLEWARE = [
Expand Down Expand Up @@ -178,7 +180,7 @@ def list_env(key):
}


if DJANGO_ENV != "production":
if not IS_PRODUCTION:
if environ.get("BLOB_STORAGE_CONNECTION_STRING"):
# Use connection string if provided (e.g., in local development using Azurite)
dicom_storage_options = {
Expand Down
11 changes: 11 additions & 0 deletions manage_breast_screening/core/jinja2/layout-app.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
{% block pageTitle %}{% if form and form.errors %}Error: {% endif %}{% if page_title %}{{ page_title }} – {% endif %}Manage breast screening – NHS{% endblock %}

{% block header %}
{% if not IS_PRODUCTION %}
<div class="app-environment nhsuk-tag--grey">
<div class="nhsuk-width-container">
<strong class="nhsuk-tag nhsuk-tag--grey">
{{ DJANGO_ENV }}
</strong>
This is the {{ DJANGO_ENV }} environment.
</div>
</div>
{% endif %}

{{ header({
"classes": "nhsuk-header--inline",
"service": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
from datetime import datetime, timedelta
from os import getenv

import yaml
from django.conf import settings
Expand Down Expand Up @@ -79,7 +78,7 @@ def diagram_file(self, file_name):
return open(MAMMOGRAM_DIAGRAMS_DIR / file_name, "rb")

def handle(self, *args, **kwargs):
if getenv("DJANGO_ENV", "production") == "production":
if settings.IS_PRODUCTION:
raise Exception("This command cannot be run in production")

if not kwargs["noinput"]:
Expand Down
Loading