· 4 years ago · Mar 25, 2021, 02:36 PM
1"""
2Django settings for proyecto project.
3
4Generated by 'django-admin startproject' using Django 3.1.6.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/3.1/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/3.1/ref/settings/
11"""
12
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
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 'hboit_kh7kg4qch^aqged$q7+35w1vkg6d_uhzp$j3+g3g^6jd'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = []
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 'users',
41 'base',
42 'products',
43 'rest_framework',
44 'rest_framework.authtoken',
45
46]
47TOKEN_EXPIRED_AFTER_SECONDS = 20
48
49
50
51
52MIDDLEWARE = [
53 'django.middleware.security.SecurityMiddleware',
54 'django.contrib.sessions.middleware.SessionMiddleware',
55 'django.middleware.common.CommonMiddleware',
56 'django.middleware.csrf.CsrfViewMiddleware',
57 'django.contrib.auth.middleware.AuthenticationMiddleware',
58 'django.contrib.messages.middleware.MessageMiddleware',
59 'django.middleware.clickjacking.XFrameOptionsMiddleware',
60 'simple_history.middleware.HistoryRequestMiddleware',
61]
62
63ROOT_URLCONF = 'proyecto.urls'
64
65TEMPLATES = [
66 {
67 'BACKEND': 'django.template.backends.django.DjangoTemplates',
68 'DIRS': [],
69 'APP_DIRS': True,
70 'OPTIONS': {
71 'context_processors': [
72 'django.template.context_processors.debug',
73 'django.template.context_processors.request',
74 'django.contrib.auth.context_processors.auth',
75 'django.contrib.messages.context_processors.messages',
76 ],
77 },
78 },
79]
80
81WSGI_APPLICATION = 'proyecto.wsgi.application'
82
83REST_FRAMEWORK = {
84 'DEFAULT_PERMISSION_CLASSES': (
85 # 'rest_framework.permissions.IsAuthenticated',
86 ),
87 'DEFAULT_AUTHENTICATION_CLASSES': (
88 'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
89 'rest_framework.authentication.SessionAuthentication',
90 'rest_framework.authentication.BasicAuthentication',
91 ),
92
93}
94# Database
95# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
96
97DATABASES = {
98 'default': {
99 'ENGINE': 'django.db.backends.sqlite3',
100 'NAME': BASE_DIR / 'db.sqlite3',
101 }
102}
103
104
105# Password validation
106# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
107
108AUTH_PASSWORD_VALIDATORS = [
109 {
110 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
111 },
112 {
113 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
114 },
115 {
116 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
117 },
118 {
119 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
120 },
121]
122
123
124# Internationalization
125# https://docs.djangoproject.com/en/3.1/topics/i18n/
126
127LANGUAGE_CODE = 'es'
128
129TIME_ZONE = 'UTC'
130
131USE_I18N = True
132
133USE_L10N = True
134
135USE_TZ = True
136
137AUTH_USER_MODEL = 'users.User'
138
139# Static files (CSS, JavaScript, Images)
140# https://docs.djangoproject.com/en/3.1/howto/static-files/
141
142STATIC_URL = '/static/'
143