· 5 years ago · Nov 19, 2019, 10:58 PM
1"""
2Django settings for ecommerce project.
3
4Generated by 'django-admin startproject' using Django 2.2.1.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.2/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.2/ref/settings/
11"""
12
13import os
14
15# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxx'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = False
27
28ALLOWED_HOSTS = ['xxxxxxxxxxxxxxxxxxxxxx']
29
30
31# Application definition
32
33INSTALLED_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 'crispy_forms',
41 'tienda',
42 'subcategorias',
43 'carrito',
44 'pedidos',
45 'flyers',
46 'banner',
47 'productosdestacados',
48 'marcasdestacadas',
49 'redessociales',
50 'smart_selects',
51 'mapwidgets',
52 'widget_tweaks',
53 'django_object_actions',
54 'sorl.thumbnail',
55 'adminsortable2',
56]
57
58MIDDLEWARE = [
59 'django.middleware.security.SecurityMiddleware',
60 'django.contrib.sessions.middleware.SessionMiddleware',
61 'django.middleware.common.CommonMiddleware',
62 'django.middleware.csrf.CsrfViewMiddleware',
63 'django.contrib.auth.middleware.AuthenticationMiddleware',
64 'django.contrib.messages.middleware.MessageMiddleware',
65 'django.middleware.clickjacking.XFrameOptionsMiddleware',
66]
67
68ROOT_URLCONF = 'ecommerce.urls'
69
70TEMPLATES = [
71 {
72 'BACKEND': 'django.template.backends.django.DjangoTemplates',
73 'DIRS': [],
74 'APP_DIRS': True,
75 'OPTIONS': {
76 'context_processors': [
77 'django.template.context_processors.debug',
78 'django.template.context_processors.request',
79 'django.contrib.auth.context_processors.auth',
80 'django.contrib.messages.context_processors.messages',
81 'tienda.procesador_contexto.navbar',
82 'carrito.procesador_contexto.carrito',
83 ],
84 },
85 },
86]
87
88WSGI_APPLICATION = 'ecommerce.wsgi.application'
89
90
91# Database
92# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
93DATABASES = {
94 'default': {
95 'ENGINE': 'django.db.backends.postgresql_psycopg2',
96 'NAME': 'xxxxxxxxxxxxxxxxxxxxxx',
97 'USER': 'xxxxxxxxxxxxxxxxxxxxxx',
98 'PASSWORD': 'xxxxxxxxxxxxxxxxxxxxxx',
99 'HOST': 'xxxxxxxxxxxxxxxxxxxxxx',
100 'PORT': '25060',
101 }
102}
103# Password validation
104# https://docs.djangoproject.com/en/2.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
122# Internationalization
123# https://docs.djangoproject.com/en/2.2/topics/i18n/
124
125LANGUAGE_CODE = 'es-ar'
126
127TIME_ZONE = 'America/Argentina/Cordoba'
128
129USE_I18N = True
130
131USE_L10N = True
132
133USE_TZ = True
134
135
136# Static files (CSS, JavaScript, Images)
137# https://docs.djangoproject.com/en/2.2/howto/static-files/
138
139STATIC_URL = '/tienda/static/'
140
141MEDIA_URL = '/productos/'
142
143MEDIA_ROOT = os.path.join(BASE_DIR, 'productos/')
144
145CART_SESSION_ID = 'carrito'
146
147CRISPY_TEMPLATE_PACK = 'bootstrap4'
148
149JQUERY_URL = True
150
151MAP_WIDGETS = {
152 "GooglePointFieldWidget": (
153 ("zoom", 13),
154 ("mapCenterLocationName", "Argentina/Cordoba"),
155 ("GooglePlaceAutocompleteOptions", {'componentRestrictions': {'country': 'arg'}}),
156 ("markerFitZoom", 16),
157 ),
158 "GOOGLE_MAP_API_KEY": 'xxxxxxxxxxxxxxxxxxxxxx'
159}
160
161# Configuration static files whit digital ocean spaces
162
163AWS_ACCESS_KEY_ID = 'xxxxxxxxxxxxxxxxxxxxxx'
164AWS_SECRET_ACCESS_KEY = 'xxxxxxxxxxxxxxxxxxxxxx'
165
166AWS_STORAGE_BUCKET_NAME = 'xxxxxxxxxxxxxxxxxxxxxx'
167AWS_S3_ENDPOINT_URL = 'xxxxxxxxxxxxxxxxxxxxxx'
168AWS_S3_CUSTOM_DOMAIN = 'xxxxxxxxxxxxxxxxxxxxxx'
169AWS_S3_OBJECT_PARAMETERS = {
170 'CacheControl': 'max-age=86400',
171}
172AWS_LOCATION = 'static'
173AWS_DEFAULT_ACL = 'public-read'
174
175STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
176
177STATIC_URL = '{}/{}/'.format(AWS_S3_CUSTOM_DOMAIN, AWS_LOCATION)
178# END Configuration static files whit digital ocean spaces
179
180STATIC_ROOT = 'tienda/static/'
181
182
183# Parametros de seguridad
184SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
185SESSION_COOKIE_SECURE = True
186CSRF_COOKIE_SECURE = True
187SECURE_SSL_REDIRECT = True
188
189'''
190CORREOS ELECTRONICO
191'''
192EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
193EMAIL_HOST = 'smtp.gmail.com'
194EMAIL_USE_TLS = True
195EMAIL_PORT = 587
196EMAIL_HOST_USER = 'xxxxxxxxxxxxxxxxxxxxxx'
197EMAIL_HOST_PASSWORD = 'xxxxxxxxxxxxxxxxxxxxxx'
198
199
200# allow upload big file
201DATA_UPLOAD_MAX_MEMORY_SIZE = 1024 * 1024 * 4 # 4 megas
202FILE_UPLOAD_MAX_MEMORY_SIZE = DATA_UPLOAD_MAX_MEMORY_SIZE