Skip to content

Commit c99b7d2

Browse files
Update settings.py for Djongo and octofit_db configuration
1 parent 98d37fb commit c99b7d2

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
"""
2+
Django settings for octofit_tracker project.
3+
4+
Generated by 'django-admin startproject' using Django 4.1.7.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/4.1/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/4.1/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
15+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
16+
BASE_DIR = Path(__file__).resolve().parent.parent
17+
18+
19+
# Quick-start development settings - unsuitable for production
20+
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
21+
22+
# SECURITY WARNING: keep the secret key used in production secret!
23+
SECRET_KEY = 'django-insecure-zv+b2zp*2&o30ve+^9=utg8%d=68vnc*!w5=573j=$5o(8m$k='
24+
25+
# SECURITY WARNING: don't run with debug turned on in production!
26+
DEBUG = True
27+
28+
ALLOWED_HOSTS = ['*']
29+
30+
31+
# Application definition
32+
33+
INSTALLED_APPS = [
34+
'django.contrib.admin',
35+
'django.contrib.auth',
36+
'django.contrib.contenttypes',
37+
'django.contrib.sessions',
38+
'django.contrib.messages',
39+
'django.contrib.staticfiles',
40+
'octofit_tracker',
41+
'rest_framework',
42+
'djongo',
43+
'corsheaders',
44+
]
45+
46+
MIDDLEWARE = [
47+
'corsheaders.middleware.CorsMiddleware',
48+
'django.middleware.security.SecurityMiddleware',
49+
'django.contrib.sessions.middleware.SessionMiddleware',
50+
'django.middleware.common.CommonMiddleware',
51+
'django.middleware.csrf.CsrfViewMiddleware',
52+
'django.contrib.auth.middleware.AuthenticationMiddleware',
53+
'django.contrib.messages.middleware.MessageMiddleware',
54+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
55+
]
56+
57+
ROOT_URLCONF = 'octofit_tracker.urls'
58+
59+
TEMPLATES = [
60+
{
61+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
62+
'DIRS': [],
63+
'APP_DIRS': True,
64+
'OPTIONS': {
65+
'context_processors': [
66+
'django.template.context_processors.debug',
67+
'django.template.context_processors.request',
68+
'django.contrib.auth.context_processors.auth',
69+
'django.contrib.messages.context_processors.messages',
70+
],
71+
},
72+
},
73+
]
74+
75+
WSGI_APPLICATION = 'octofit_tracker.wsgi.application'
76+
77+
78+
# Database
79+
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
80+
81+
DATABASES = {
82+
'default': {
83+
'ENGINE': 'djongo',
84+
'NAME': 'octofit_db',
85+
'ENFORCE_SCHEMA': False,
86+
'CLIENT': {
87+
'host': 'localhost',
88+
'port': 27017,
89+
},
90+
}
91+
}
92+
93+
94+
# Password validation
95+
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
96+
97+
AUTH_PASSWORD_VALIDATORS = [
98+
{
99+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
100+
},
101+
{
102+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
103+
},
104+
{
105+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
106+
},
107+
{
108+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
109+
},
110+
]
111+
112+
113+
# Internationalization
114+
# https://docs.djangoproject.com/en/4.1/topics/i18n/
115+
116+
LANGUAGE_CODE = 'en-us'
117+
118+
TIME_ZONE = 'UTC'
119+
120+
USE_I18N = True
121+
122+
USE_TZ = True
123+
124+
125+
# Static files (CSS, JavaScript, Images)
126+
# Static files (CSS, JavaScript, Images)
127+
# https://docs.djangoproject.com/en/4.1/howto/static-files/
128+
129+
STATIC_URL = 'static/'
130+
131+
# CORS settings
132+
CORS_ALLOW_ALL_ORIGINS = True
133+
CORS_ALLOW_CREDENTIALS = True
134+
CORS_ALLOW_HEADERS = ['*']
135+
CORS_ALLOW_METHODS = ['DELETE', 'GET', 'OPTIONS', 'PATCH', 'POST', 'PUT']
136+
137+
138+
# Default primary key field type
139+
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
140+
141+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

0 commit comments

Comments
 (0)