mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-09 17:52:21 +01:00
Split production and development settings
This commit is contained in:
@ -3,7 +3,13 @@ import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marietje.settings.settings")
|
||||
try:
|
||||
import marietje.settings.production # noqa
|
||||
except ModuleNotFoundError:
|
||||
# Use the development settings if the production settings are not available (so we're on a dev machine)
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marietje.settings.development")
|
||||
else:
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "marietje.settings.production")
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError:
|
||||
|
||||
@ -1,14 +1,7 @@
|
||||
"""
|
||||
Django settings for marietje project.
|
||||
"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
SECRET_KEY = 'sae2hahHao1soo0Ocoz5Ieh1Ushae6feJe4mooliooj0Ula8'
|
||||
DEBUG = False
|
||||
ALLOWED_HOSTS = ['*']
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
@ -64,18 +57,6 @@ TEMPLATES = [
|
||||
|
||||
WSGI_APPLICATION = 'marietje.wsgi.application'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'marietje',
|
||||
'USER': 'marietje',
|
||||
'PASSWORD': 'v8TzZwdAdSi7Tk5I',
|
||||
'HOST': 'localhost',
|
||||
'PORT': '3306',
|
||||
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
|
||||
}
|
||||
}
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
@ -147,12 +128,6 @@ OAUTH2_PROVIDER = {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
# zc files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/1.10/howto/static-files/
|
||||
|
||||
BASE_URL = 'https://marietje-zuid.science.ru.nl'
|
||||
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
STATIC_URL = '/static/'
|
||||
LOGIN_URL = '/login/'
|
||||
@ -164,10 +139,8 @@ LOGOUT_REDIRECT_URL = '/'
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
# App specific settings
|
||||
|
||||
BERTHA_HOST = ('bach.science.ru.nl', 1234)
|
||||
MAIL_FROM = 'marietje@marietje.science.ru.nl'
|
||||
|
||||
MAX_MINUTES_IN_A_ROW = 45
|
||||
|
||||
# Time range (dependent on timezone specified) when MAX_MINUTES_IN_A_ROW is in effect.
|
||||
20
marietje/marietje/settings/development.py
Normal file
20
marietje/marietje/settings/development.py
Normal file
@ -0,0 +1,20 @@
|
||||
import os
|
||||
|
||||
from .base import *
|
||||
|
||||
SECRET_KEY = 'sae2hahHao1soo0Ocoz5Ieh1Ushae6feJe4mooliooj0Ula8'
|
||||
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
|
||||
}
|
||||
}
|
||||
|
||||
BERTHA_HOST = ('localhost', 1234)
|
||||
|
||||
BASE_URL = 'http://localhost:8000'
|
||||
23
marietje/marietje/settings/production.py.example
Normal file
23
marietje/marietje/settings/production.py.example
Normal file
@ -0,0 +1,23 @@
|
||||
from .base import *
|
||||
|
||||
SECRET_KEY = '******'
|
||||
|
||||
DEBUG = False
|
||||
|
||||
ALLOWED_HOSTS = ['marietje-zuid.nl']
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'marietje',
|
||||
'USER': 'marietje',
|
||||
'PASSWORD': '******',
|
||||
'HOST': 'localhost',
|
||||
'PORT': '3306',
|
||||
'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"},
|
||||
}
|
||||
}
|
||||
|
||||
BASE_URL = 'https://marietje-zuid.science.ru.nl'
|
||||
|
||||
BERTHA_HOST = ('bach.science.ru.nl', 1234)
|
||||
Reference in New Issue
Block a user