]> git.p6c8.net - pcdenotes.git/blob - pcdenotes/settings.py
Switched from SQLite3 to MariaDB / MySQL
[pcdenotes.git] / pcdenotes / settings.py
1 """
2 Django settings for pcdenotes project.
3
4 Generated by 'django-admin startproject' using Django 3.2.11.
5
6 For more information on this file, see
7 https://docs.djangoproject.com/en/3.2/topics/settings/
8
9 For the full list of settings and their values, see
10 https://docs.djangoproject.com/en/3.2/ref/settings/
11 """
12
13 from pathlib import Path
14
15 from dotenv import load_dotenv, find_dotenv
16 load_dotenv(find_dotenv())
17
18 import os
19
20 # Build paths inside the project like this: BASE_DIR / 'subdir'.
21 BASE_DIR = Path(__file__).resolve().parent.parent
22
23
24 # Quick-start development settings - unsuitable for production
25 # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
26
27 # SECURITY WARNING: keep the secret key used in production secret!
28 SECRET_KEY = str(os.getenv('PCDENOTES_SECRET_KEY'))
29
30 # SECURITY WARNING: don't run with debug turned on in production!
31 DEBUG = str(os.getenv('PCDENOTES_DEBUG', 'false')).lower() == 'true'
32
33 ALLOWED_HOSTS = ['*']
34
35
36 # Application definition
37
38 INSTALLED_APPS = [
39 'django.contrib.admin',
40 'django.contrib.auth',
41 'django.contrib.contenttypes',
42 'django.contrib.sessions',
43 'django.contrib.messages',
44 'django.contrib.staticfiles',
45 'markdownify.apps.MarkdownifyConfig',
46 'notes',
47 ]
48
49 MIDDLEWARE = [
50 'django.middleware.security.SecurityMiddleware',
51 'django.contrib.sessions.middleware.SessionMiddleware',
52 'django.middleware.common.CommonMiddleware',
53 'django.middleware.csrf.CsrfViewMiddleware',
54 'django.contrib.auth.middleware.AuthenticationMiddleware',
55 'django.contrib.messages.middleware.MessageMiddleware',
56 'django.middleware.clickjacking.XFrameOptionsMiddleware',
57 ]
58
59 ROOT_URLCONF = 'pcdenotes.urls'
60
61 TEMPLATES = [
62 {
63 'BACKEND': 'django.template.backends.django.DjangoTemplates',
64 'DIRS': [],
65 'APP_DIRS': True,
66 'OPTIONS': {
67 'context_processors': [
68 'django.template.context_processors.debug',
69 'django.template.context_processors.request',
70 'django.contrib.auth.context_processors.auth',
71 'django.contrib.messages.context_processors.messages',
72 ],
73 },
74 },
75 ]
76
77 WSGI_APPLICATION = 'pcdenotes.wsgi.application'
78
79
80 # Database
81 # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
82
83 DATABASES = {
84 'default': {
85 'ENGINE': 'django.db.backends.mysql',
86 'NAME': str(os.getenv('PCDENOTES_DB_NAME')),
87 'HOST': str(os.getenv('PCDENOTES_DB_HOST')),
88 'PORT': int(os.getenv('PCDENOTES_DB_PORT')),
89 'USER': str(os.getenv('PCDENOTES_DB_USER')),
90 'PASSWORD': str(os.getenv('PCDENOTES_DB_PASSWORD'))
91 }
92 }
93
94
95 # Password validation
96 # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
97
98 AUTH_PASSWORD_VALIDATORS = [
99 {
100 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
101 },
102 {
103 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
104 },
105 {
106 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
107 },
108 {
109 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
110 },
111 ]
112
113
114 # Internationalization
115 # https://docs.djangoproject.com/en/3.2/topics/i18n/
116
117 LANGUAGE_CODE = 'en-us'
118
119 TIME_ZONE = 'UTC'
120
121 USE_I18N = True
122
123 USE_L10N = True
124
125 USE_TZ = True
126
127
128 # Static files (CSS, JavaScript, Images)
129 # https://docs.djangoproject.com/en/3.2/howto/static-files/
130
131 STATIC_URL = '/static/'
132 STATIC_ROOT = BASE_DIR / 'static'
133
134 # Default primary key field type
135 # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
136
137 DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
138
139 MARKDOWNIFY = {
140 "default": {
141 #"STRIP": False,
142 "BLEACH": False
143 }
144 }

patrick-canterino.de