Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small changes for running local debug #16

Merged
merged 2 commits into from
Jan 24, 2024
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,8 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.DS_Store

#static files dirs
staticfiles/

local.py
2 changes: 2 additions & 0 deletions core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from .settings import *
3 changes: 3 additions & 0 deletions core/local.py.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .settings import *

DEBUG = True
24 changes: 16 additions & 8 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
SECRET_KEY = "django-insecure-l!hxiq=!g2@)$-n3v0)yec128g7j=ksrdql+86%z66d-x6no5%"

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = os.getenv("DEBUG", "False") == "True"

ALLOWED_HOSTS = [
"localhost", "127.0.0.1",
"data-platform-find-moj-data-dev.apps.live.cloud-platform.service.justice.gov.uk"
"localhost",
"127.0.0.1",
".service.justice.gov.uk",
]

# Application definition
Expand Down Expand Up @@ -59,7 +60,7 @@
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [os.path.join(BASE_DIR, "templates")],
"DIRS": [BASE_DIR / "templates"],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
Expand Down Expand Up @@ -120,13 +121,15 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/

STATIC_URL = "/staticfiles/"
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
# https://whitenoise.readthedocs.io/en/latest/django.html#WHITENOISE_STATIC_PREFIX
STATIC_URL = "/static/"
# https://whitenoise.readthedocs.io/en/latest/django.html#make-sure-staticfiles-is-configured-correctly
STATIC_ROOT = BASE_DIR / "staticfiles"

MEDIA_URL = "/media/"
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_ROOT = BASE_DIR / "media"

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
STATICFILES_DIRS = [BASE_DIR / "static"]

# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
Expand All @@ -143,3 +146,8 @@

with open(SAMPLE_SEARCH_RESULTS_FILENAME) as f:
SAMPLE_SEARCH_RESULTS = yaml.safe_load(f)

try:
from local import * # type: ignore[reportMissingImports]
except ImportError:
pass
Loading