]> git.p6c8.net - pcdenotes.git/blob - pcdenotes/settings.py
Allow a title of a note used be more than once
[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 'markdownify.apps.MarkdownifyConfig',
47 'notes',
48 ]
49
50 MIDDLEWARE = [
51 'django.middleware.security.SecurityMiddleware',
52 'django.contrib.sessions.middleware.SessionMiddleware',
53 'django.middleware.common.CommonMiddleware',
54 'django.middleware.csrf.CsrfViewMiddleware',
55 'django.contrib.auth.middleware.AuthenticationMiddleware',
56 'django.contrib.messages.middleware.MessageMiddleware',
57 'django.middleware.clickjacking.XFrameOptionsMiddleware',
58 ]
59
60 ROOT_URLCONF = 'pcdenotes.urls'
61
62 TEMPLATES = [
63 {
64 'BACKEND': 'django.template.backends.django.DjangoTemplates',
65 'DIRS': [],
66 'APP_DIRS': True,
67 'OPTIONS': {
68 'context_processors': [
69 'django.template.context_processors.debug',
70 'django.template.context_processors.request',
71 'django.contrib.auth.context_processors.auth',
72 'django.contrib.messages.context_processors.messages',
73 ],
74 },
75 },
76 ]
77
78 WSGI_APPLICATION = 'pcdenotes.wsgi.application'
79
80
81 # Database
82 # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
83
84 DATABASES = {
85 'default': {
86 'ENGINE': 'django.db.backends.mysql',
87 'NAME': str(os.getenv('PCDENOTES_DB_NAME')),
88 'HOST': str(os.getenv('PCDENOTES_DB_HOST')),
89 'PORT': int(os.getenv('PCDENOTES_DB_PORT')),
90 'USER': str(os.getenv('PCDENOTES_DB_USER')),
91 'PASSWORD': str(os.getenv('PCDENOTES_DB_PASSWORD'))
92 }
93 }
94
95
96 # Password validation
97 # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
98
99 AUTH_PASSWORD_VALIDATORS = [
100 {
101 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
102 },
103 {
104 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
105 },
106 {
107 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
108 },
109 {
110 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
111 },
112 ]
113
114
115 # Internationalization
116 # https://docs.djangoproject.com/en/3.2/topics/i18n/
117
118 LANGUAGE_CODE = 'en-us'
119
120 TIME_ZONE = 'UTC'
121
122 USE_I18N = True
123
124 USE_L10N = True
125
126 USE_TZ = True
127
128
129 # Static files (CSS, JavaScript, Images)
130 # https://docs.djangoproject.com/en/3.2/howto/static-files/
131
132 STATIC_URL = '/static/'
133 STATIC_ROOT = BASE_DIR / 'static'
134
135 # Default primary key field type
136 # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
137
138 DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
139
140 MARKDOWNIFY = {
141 "default": {
142 #"STRIP": False,
143 "BLEACH": False
144 }
145 }
146
147 NOTES_PER_PAGE = 5

patrick-canterino.de