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 @@ -51,6 +51,24 @@ a[href="#"] {
5151 color : #c80000 !important ;
5252}
5353
54+ // Environment banner at the top of the page
55+ .app-environment {
56+ @include nhsuk-font-size (14 );
57+ @include nhsuk-responsive-padding (2 , bottom );
58+ @include nhsuk-responsive-padding (2 , top );
59+
60+ .nhsuk-link {
61+ color : inherit ;
62+ }
63+
64+ .nhsuk-width-container {
65+ align-items : baseline ;
66+ display : flex ;
67+ flex-wrap : wrap ;
68+ gap : nhsuk-spacing (1 ) nhsuk-spacing (2 );
69+ }
70+ }
71+
5472// Status tag positioning within headers
5573.app-header {
5674 position : relative ;
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ def environment(**options):
4141 "raise" : raise_helper ,
4242 "static" : static ,
4343 "url" : reverse ,
44+ "DJANGO_ENV" : settings .DJANGO_ENV ,
4445 }
4546 )
4647
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
@@ -76,7 +78,7 @@ def list_env(key):
7678 "ninja" ,
7779]
7880
79- if DJANGO_ENV != "production" :
81+ if not IS_PRODUCTION :
8082 INSTALLED_APPS .append ("manage_breast_screening.nonprod" )
8183
8284MIDDLEWARE = [
@@ -178,7 +180,7 @@ def list_env(key):
178180}
179181
180182
181- if DJANGO_ENV != "production" :
183+ if not IS_PRODUCTION :
182184 if environ .get ("BLOB_STORAGE_CONNECTION_STRING" ):
183185 # Use connection string if provided (e.g., in local development using Azurite)
184186 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
65from django .conf import settings
@@ -79,7 +78,7 @@ def diagram_file(self, file_name):
7978 return open (MAMMOGRAM_DIAGRAMS_DIR / file_name , "rb" )
8079
8180 def handle (self , * args , ** kwargs ):
82- if getenv ( "DJANGO_ENV" , "production" ) == "production" :
81+ if settings . IS_PRODUCTION :
8382 raise Exception ("This command cannot be run in production" )
8483
8584 if not kwargs ["noinput" ]:
You can’t perform that action at this time.
0 commit comments