Skip to content

Commit

Permalink
Add production settings
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrykin committed Jan 29, 2024
1 parent 7e57109 commit f95cc41
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tournaments/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tournaments.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tournaments.settings.development')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,7 @@
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-ouqc8j0sk$gn+*9zja*ii=rs=$q()cs$e*9$fg1(y28d#m8m$d'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
BASE_DIR = Path(__file__).resolve().parent.parent.parent


# Application definition
Expand Down
13 changes: 13 additions & 0 deletions tournaments/tournaments/settings/development.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from tournaments.settings.common import *


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-ouqc8j0sk$gn+*9zja*ii=rs=$q()cs$e*9$fg1(y28d#m8m$d'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ['*']
16 changes: 16 additions & 0 deletions tournaments/tournaments/settings/production.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os

from tournaments.settings.common import *


# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ['SECRET_KEY']

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = [
os.environ['HOSTNAME'],
]

STATIC_ROOT = BASE_DIR / '../deployed'

0 comments on commit f95cc41

Please sign in to comment.