NitinBot001 commited on
Commit
a101cbb
·
verified ·
1 Parent(s): d3d1dfd

Update MistryMart/settings.py

Browse files
Files changed (1) hide show
  1. MistryMart/settings.py +162 -152
MistryMart/settings.py CHANGED
@@ -1,152 +1,162 @@
1
- """
2
- Django settings for MistryMart project.
3
-
4
- Generated by 'django-admin startproject' using Django 5.2.4.
5
-
6
- For more information on this file, see
7
- https://docs.djangoproject.com/en/5.2/topics/settings/
8
-
9
- For the full list of settings and their values, see
10
- https://docs.djangoproject.com/en/5.2/ref/settings/
11
- """
12
-
13
- from pathlib import Path
14
- import os
15
-
16
- # Build paths inside the project like this: BASE_DIR / 'subdir'.
17
- BASE_DIR = Path(__file__).resolve().parent.parent
18
-
19
-
20
- # Quick-start development settings - unsuitable for production
21
- # See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
22
-
23
- # SECURITY WARNING: keep the secret key used in production secret!
24
- SECRET_KEY = 'django-insecure-ku3+qwo=e#h7@ur7v=tmrr_=6ihz_y)w6p9$b1ix&oy^+lh_7b'
25
-
26
- # SECURITY WARNING: don't run with debug turned on in production!
27
- DEBUG = True
28
-
29
- ALLOWED_HOSTS = []
30
-
31
-
32
- # Application definition
33
-
34
- INSTALLED_APPS = [
35
- 'django.contrib.admin',
36
- 'django.contrib.auth',
37
- 'django.contrib.contenttypes',
38
- 'django.contrib.sessions',
39
- 'django.contrib.messages',
40
- 'django.contrib.staticfiles',
41
- 'Accounts',
42
- 'Analytics',
43
- 'Boxes',
44
- 'Gamification',
45
- 'Home',
46
- 'cart',
47
-
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
- AUTH_USER_MODEL = 'Accounts.User'
61
-
62
-
63
- ROOT_URLCONF = 'MistryMart.urls'
64
-
65
- TEMPLATES = [
66
- {
67
- 'BACKEND': 'django.template.backends.django.DjangoTemplates',
68
- 'DIRS': [BASE_DIR , 'templates'],
69
- 'DIRS': [BASE_DIR , 'Accounts/templates'],
70
- 'DIRS': [BASE_DIR , 'Analytics/templates'],
71
- 'DIRS': [BASE_DIR , 'Boxes/templates'],
72
- 'DIRS': [BASE_DIR , 'Gamification/templates'],
73
- 'DIRS': [BASE_DIR , 'Home/templates'],
74
- 'DIRS': [BASE_DIR , 'Order/templates'],
75
-
76
-
77
- 'APP_DIRS': True,
78
- 'OPTIONS': {
79
- 'context_processors': [
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
-
88
- WSGI_APPLICATION = 'MistryMart.wsgi.application'
89
-
90
-
91
- # Database
92
- # https://docs.djangoproject.com/en/5.2/ref/settings/#databases
93
-
94
- DATABASES = {
95
- 'default': {
96
- 'ENGINE': 'django.db.backends.sqlite3',
97
- 'NAME': BASE_DIR / 'db.sqlite3',
98
- }
99
- }
100
-
101
-
102
- # Password validation
103
- # https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
104
-
105
- AUTH_PASSWORD_VALIDATORS = [
106
- {
107
- 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
108
- },
109
- {
110
- 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
111
- },
112
- {
113
- 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
114
- },
115
- {
116
- 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
117
- },
118
- ]
119
-
120
-
121
- # Internationalization
122
- # https://docs.djangoproject.com/en/5.2/topics/i18n/
123
-
124
- LANGUAGE_CODE = 'en-us'
125
-
126
- TIME_ZONE = 'UTC'
127
-
128
- USE_I18N = True
129
-
130
- USE_TZ = True
131
-
132
-
133
- # Static files (CSS, JavaScript, Images)
134
- # https://docs.djangoproject.com/en/5.2/howto/static-files/
135
-
136
-
137
- STATIC_URL = 'static/'
138
- STATICFILES_DIRS = [
139
- os.path.join(BASE_DIR,'static'),
140
-
141
- # os.path.join(BASE_DIR,'Home/static')
142
- ]
143
- # STATIC_ROOT = os.path.join(BASE_DIR, 'Home/static')
144
-
145
-
146
- MEDIA_URL='/images/'
147
- MEDIA_ROOT = os.path.join(BASE_DIR , 'static/images')
148
-
149
- # Default primary key field type
150
- # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
151
-
152
- DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Django settings for MistryMart project.
3
+
4
+ Generated by 'django-admin startproject' using Django 5.2.4.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/5.2/topics/settings/
8
+
9
+ For the full list of settings and their values, see
10
+ https://docs.djangoproject.com/en/5.2/ref/settings/
11
+ """
12
+
13
+ from pathlib import Path
14
+ import os
15
+
16
+ # Build paths inside the project like this: BASE_DIR / 'subdir'.
17
+ BASE_DIR = Path(__file__).resolve().parent.parent
18
+
19
+
20
+ # Quick-start development settings - unsuitable for production
21
+ # See https://docs.djangoproject.com/en/5.2/howto/deployment/checklist/
22
+
23
+ # SECURITY WARNING: keep the secret key used in production secret!
24
+ SECRET_KEY = os.environ.get('SECRET_KEY', 'django-insecure-ku3+qwo=e#h7@ur7v=tmrr_=6ihz_y)w6p9$b1ix&oy^+lh_7b')
25
+
26
+ # SECURITY WARNING: don't run with debug turned on in production!
27
+ DEBUG = os.environ.get('DEBUG', 'True') == 'True'
28
+
29
+ # Updated ALLOWED_HOSTS to include your Hugging Face Space domain
30
+ ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', 'nitinbot001-mistrybox.hf.space,localhost,127.0.0.1').split(',')
31
+
32
+ # Proxy settings for Hugging Face Spaces
33
+ USE_X_FORWARDED_HOST = True
34
+ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
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
+ 'Accounts',
46
+ 'Analytics',
47
+ 'Boxes',
48
+ 'Gamification',
49
+ 'Home',
50
+ 'cart',
51
+
52
+ ]
53
+
54
+ MIDDLEWARE = [
55
+ 'django.middleware.security.SecurityMiddleware',
56
+ 'django.contrib.sessions.middleware.SessionMiddleware',
57
+ 'django.middleware.common.CommonMiddleware',
58
+ 'django.middleware.csrf.CsrfViewMiddleware',
59
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
60
+ 'django.contrib.messages.middleware.MessageMiddleware',
61
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
62
+ ]
63
+
64
+ AUTH_USER_MODEL = 'Accounts.User'
65
+
66
+
67
+ ROOT_URLCONF = 'MistryMart.urls'
68
+
69
+ TEMPLATES = [
70
+ {
71
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
72
+ 'DIRS': [
73
+ BASE_DIR / 'templates',
74
+ BASE_DIR / 'Accounts/templates',
75
+ BASE_DIR / 'Analytics/templates',
76
+ BASE_DIR / 'Boxes/templates',
77
+ BASE_DIR / 'Gamification/templates',
78
+ BASE_DIR / 'Home/templates',
79
+ BASE_DIR / 'Order/templates',
80
+ ],
81
+ 'APP_DIRS': True,
82
+ 'OPTIONS': {
83
+ 'context_processors': [
84
+ 'django.template.context_processors.request',
85
+ 'django.contrib.auth.context_processors.auth',
86
+ 'django.contrib.messages.context_processors.messages',
87
+ ],
88
+ },
89
+ },
90
+ ]
91
+
92
+ WSGI_APPLICATION = 'MistryMart.wsgi.application'
93
+
94
+
95
+ # Database
96
+ # https://docs.djangoproject.com/en/5.2/ref/settings/#databases
97
+
98
+ DATABASES = {
99
+ 'default': {
100
+ 'ENGINE': 'django.db.backends.sqlite3',
101
+ 'NAME': BASE_DIR / 'db.sqlite3',
102
+ }
103
+ }
104
+
105
+
106
+ # Password validation
107
+ # https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
108
+
109
+ AUTH_PASSWORD_VALIDATORS = [
110
+ {
111
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
112
+ },
113
+ {
114
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
115
+ },
116
+ {
117
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
118
+ },
119
+ {
120
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
121
+ },
122
+ ]
123
+
124
+
125
+ # Internationalization
126
+ # https://docs.djangoproject.com/en/5.2/topics/i18n/
127
+
128
+ LANGUAGE_CODE = 'en-us'
129
+
130
+ TIME_ZONE = 'UTC'
131
+
132
+ USE_I18N = True
133
+
134
+ USE_TZ = True
135
+
136
+
137
+ # Static files (CSS, JavaScript, Images)
138
+ # https://docs.djangoproject.com/en/5.2/howto/static-files/
139
+
140
+
141
+ STATIC_URL = 'static/'
142
+ STATICFILES_DIRS = [
143
+ os.path.join(BASE_DIR,'static'),
144
+
145
+ # os.path.join(BASE_DIR,'Home/static')
146
+ ]
147
+ # STATIC_ROOT = os.path.join(BASE_DIR, 'Home/static')
148
+
149
+
150
+ MEDIA_URL='/images/'
151
+ MEDIA_ROOT = os.path.join(BASE_DIR , 'static/images')
152
+
153
+ # Default primary key field type
154
+ # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
155
+
156
+ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
157
+
158
+ # CSRF trusted origins for Hugging Face Spaces
159
+ CSRF_TRUSTED_ORIGINS = [
160
+ 'https://nitinbot001-mistrybox.hf.space',
161
+ 'https://*.hf.space',
162
+ ]