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

patrick-canterino.de