File tree Expand file tree Collapse file tree
nonprod/management/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,6 +50,24 @@ a[href="#"] {
5050 color : #c80000 !important ;
5151}
5252
53+ // Environment banner at the top of the page
54+ .app-environment {
55+ @include nhsuk-font-size (14 );
56+ @include nhsuk-responsive-padding (2 , bottom );
57+ @include nhsuk-responsive-padding (2 , top );
58+
59+ .nhsuk-link {
60+ color : inherit ;
61+ }
62+
63+ .nhsuk-width-container {
64+ align-items : baseline ;
65+ display : flex ;
66+ flex-wrap : wrap ;
67+ gap : nhsuk-spacing (1 ) nhsuk-spacing (2 );
68+ }
69+ }
70+
5371// Status tag positioning within headers
5472.app-header {
5573 position : relative ;
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ def list_env(key):
3434
3535DJANGO_ENV = environ .get ("DJANGO_ENV" , "production" )
3636
37+ IS_PRODUCTION = DJANGO_ENV == "production"
38+
3739ALLOWED_HOSTS = list_env ("ALLOWED_HOSTS" )
3840CSRF_TRUSTED_ORIGINS = list_env ("CSRF_TRUSTED_ORIGINS" )
3941
@@ -75,7 +77,7 @@ def list_env(key):
7577 "csp" ,
7678]
7779
78- if DJANGO_ENV != "production" :
80+ if not IS_PRODUCTION :
7981 INSTALLED_APPS .append ("manage_breast_screening.nonprod" )
8082
8183MIDDLEWARE = [
@@ -177,7 +179,7 @@ def list_env(key):
177179}
178180
179181
180- if DJANGO_ENV != "production" :
182+ if not IS_PRODUCTION :
181183 if environ .get ("BLOB_STORAGE_CONNECTION_STRING" ):
182184 # Use connection string if provided (e.g., in local development using Azurite)
183185 dicom_storage_options = {
Original file line number Diff line number Diff line change 1414{% block pageTitle %}{% if form and form .errors %} Error: {% endif %}{% if page_title %} {{ page_title }} – {% endif %} Manage breast screening – NHS{% endblock %}
1515
1616{% block header %}
17+ {% if not IS_PRODUCTION %}
18+ <div class =" app-environment nhsuk-tag--grey" >
19+ <div class =" nhsuk-width-container" >
20+ <strong class =" nhsuk-tag nhsuk-tag--grey" >
21+ {{ DJANGO_ENV }}
22+ </strong >
23+ This is the {{ DJANGO_ENV }} environment.
24+ </div >
25+ </div >
26+ {% endif %}
27+
1728 {{ header({
1829 "classes": "nhsuk-header--inline",
1930 "service": {
Original file line number Diff line number Diff line change 11import logging
22from datetime import datetime , timedelta
3- from os import getenv
43
54import yaml
5+ from django .conf import settings
66from django .core .management .base import BaseCommand
77from django .db import connection
88from django .test import override_settings
@@ -54,7 +54,7 @@ def file_from_name(self, file_name):
5454 return open ("manage_breast_screening/data/" + file_name )
5555
5656 def handle (self , * args , ** kwargs ):
57- if getenv ( "DJANGO_ENV" , "production" ) == "production" :
57+ if settings . IS_PRODUCTION :
5858 raise Exception ("This command cannot be run in production" )
5959
6060 if not kwargs ["noinput" ]:
You can’t perform that action at this time.
0 commit comments