· 4 years ago · May 05, 2021, 11:38 AM
1"""
2Django settings for smsbomb project.
3
4Generated by 'django-admin startproject' using Django 3.2.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/3.2/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/3.2/ref/settings/
11"""
12import os.path
13from pathlib import Path
14
15# Build paths inside the project like this: BASE_DIR / 'subdir'.
16BASE_DIR = Path(__file__).resolve().parent.parent
17
18# Quick-start development settings - unsuitable for production
19# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
20
21# SECURITY WARNING: keep the secret key used in production secret!
22SECRET_KEY = 'django-insecure-v$@mhb%yp-$@7727+vq-=7--61a__ro_%r60wms#p9t#%^y!%z'
23
24# SECURITY WARNING: don't run with debug turned on in production!
25DEBUG = False
26
27ALLOWED_HOSTS = ["216.127.164.177"]
28
29# Application definition
30
31INSTALLED_APPS = [
32 'django.contrib.admin',
33 'django.contrib.auth',
34 'django.contrib.contenttypes',
35 'django.contrib.sessions',
36 'django.contrib.messages',
37 'django.contrib.staticfiles',
38 'sms.apps.SmsConfig',
39 'logintool.apps.LogintoolConfig',
40 'corsheaders',
41]
42
43MIDDLEWARE = [
44 'corsheaders.middleware.CorsMiddleware',
45 'django.middleware.security.SecurityMiddleware',
46 'django.contrib.sessions.middleware.SessionMiddleware',
47 'django.middleware.common.CommonMiddleware',
48 'django.contrib.auth.middleware.AuthenticationMiddleware',
49 'django.contrib.messages.middleware.MessageMiddleware',
50 'django.middleware.clickjacking.XFrameOptionsMiddleware',
51 'whitenoise.middleware.WhiteNoiseMiddleware'
52]
53
54MIDDLEWARE_CLASSES = (
55
56 'corsheaders.middleware.CorsMiddleware',
57 'django.middleware.common.CommonMiddleware',
58
59)
60
61CORS_ORIGIN_ALLOW_ALL = True
62
63# CORS_ORIGIN_WHITELIST = '*'
64CORS_ALLOW_CREDENTIALS = True
65CSRF_USE_SESIONS = False
66CSRF_COOKIE_HTTPONLY = False
67CSRF_COOKIE_SAMESITE = None
68
69ROOT_URLCONF = 'smsbomb.urls'
70
71TEMPLATES = [
72 {
73 'BACKEND': 'django.template.backends.django.DjangoTemplates',
74 'DIRS': [BASE_DIR / 'templates']
75 ,
76 'APP_DIRS': True,
77 'OPTIONS': {
78 'context_processors': [
79 'django.template.context_processors.debug',
80 'django.template.context_processors.request',
81 'django.contrib.auth.context_processors.auth',
82 'django.contrib.messages.context_processors.messages',
83 ],
84 },
85 },
86]
87
88WSGI_APPLICATION = 'smsbomb.wsgi.application'
89
90STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
91
92# Database
93# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
94
95DATABASES = {
96 'default': {
97 'ENGINE': 'django.db.backends.sqlite3',
98 'NAME': BASE_DIR / 'db.sqlite3',
99 }
100}
101
102
103# Password validation
104# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
105
106AUTH_PASSWORD_VALIDATORS = [
107 {
108 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
109 },
110 {
111 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
112 },
113 {
114 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
115 },
116 {
117 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
118 },
119]
120
121# Internationalization
122# https://docs.djangoproject.com/en/3.2/topics/i18n/
123
124LANGUAGE_CODE = 'en-us'
125
126TIME_ZONE = 'Asia/Dhaka'
127
128# USE_I18N = True
129#
130# USE_L10N = True
131#
132# USE_TZ = True
133
134# Static files (CSS, JavaScript, Images)
135# https://docs.djangoproject.com/en/3.2/howto/static-files/
136
137STATIC_URL = '/static/'
138
139STATICFILES_DIRS = [
140 BASE_DIR / "static"
141]
142
143STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
144
145# Default primary key field type
146# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
147
148DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'