Skip to content

Commit 10ba456

Browse files
committed
Separate development and production settings
1 parent e0f5ee7 commit 10ba456

File tree

5 files changed

+38
-6
lines changed

5 files changed

+38
-6
lines changed

.github/workflows/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ env:
55
jobs:
66
test:
77
runs-on: ubuntu-latest
8+
env:
9+
DJANGO_SETTINGS_MODULE: ptplot_site.settings.dev
810
steps:
911
- name: Setup Python
1012
uses: actions/setup-python@v5

ptplot_site/settings/__init__.py

Whitespace-only changes.

ptplot_site/settings.py ptplot_site/settings/base.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,9 @@
1919
# Quick-start development settings - unsuitable for production
2020
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
2121

22-
# SECURITY WARNING: keep the secret key used in production secret!
23-
SECRET_KEY = 'django-insecure-5)qw0w+z9)*q145l8$n_@d+$dj0f++p)npdmrddazr5j$yu869'
24-
25-
# SECURITY WARNING: don't run with debug turned on in production!
26-
DEBUG = True
2722

2823
ALLOWED_HOSTS = []
2924

30-
3125
# Application definition
3226

3327
INSTALLED_APPS = [
@@ -122,3 +116,12 @@
122116
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
123117

124118
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
119+
120+
# Email
121+
ADMINS = [
122+
("David Weir", "[email protected]"),
123+
("Mika Mäki", "[email protected]")
124+
]
125+
MANAGERS = ADMINS
126+
# DEFAULT_FROM_EMAIL = ""
127+
# SERVER_EMAIL = DEFAULT_FROM_EMAIL

ptplot_site/settings/dev.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from .base import *
2+
3+
# SECURITY WARNING: don't run with debug turned on in production!
4+
DEBUG = True
5+
6+
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
7+
INTERNAL_IPS = ["127.0.0.1"]
8+
9+
# SECURITY WARNING: keep the secret key used in production secret!
10+
SECRET_KEY = 'django-insecure-5)qw0w+z9)*q145l8$n_@d+$dj0f++p)npdmrddazr5j$yu869'

ptplot_site/settings/prod.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
from .base import *
3+
4+
# SECURITY WARNING: don't run with debug turned on in production!
5+
DEBUG = False
6+
7+
ALLOWED_HOSTS = [
8+
"localhost",
9+
"ptplot.org",
10+
"ptplot-23.it.helsinki.fi",
11+
"128.214.48.116"
12+
]
13+
INTERNAL_IPS = ["127.0.0.1"]
14+
SECRET_KEY = os.environ["DJANGO_SECRET_KEY"]
15+
16+
SESSION_COOKIE_SECURE = True
17+
CSRF_COOKIE_SECURE = True

0 commit comments

Comments
 (0)