· 7 years ago · Nov 08, 2018, 06:46 PM
1"""
2Django settings for cro project.
3
4Generated by 'django-admin startproject' using Django 2.0.4.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.0/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.0/ref/settings/
11"""
12
13import os
14
15from decouple import config
16
17# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
18
19BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
20
21# Quick-start development settings - unsuitable for production
22# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
23
24# SECURITY WARNING: keep the secret key used in production secret!
25SECRET_KEY = '&%2!v_^mz5w6hn4fzv3ezizw@=+3c3(xi00o+2e&3m4h^evm+u'
26
27# SECURITY WARNING: don't run with debug turned on in production!
28DEBUG = True
29
30ALLOWED_HOSTS = ['*']
31
32PROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
33
34# Application definition
35
36INSTALLED_APPS = [
37 # Django
38 'django.contrib.admin',
39 'django.contrib.auth',
40 'django.contrib.contenttypes',
41 'django.contrib.sessions',
42 'django.contrib.messages',
43 'django.contrib.staticfiles',
44 'django_superform',
45 # 'cuser',
46 # apps
47 'apps.fiscalizacao',
48 'apps.core',
49 'rest_framework',
50 'rest_framework.authtoken',
51]
52
53TAGGIT_CASE_INSENSITIVE = True
54
55MIDDLEWARE = [
56 'django.middleware.security.SecurityMiddleware',
57 'django.contrib.sessions.middleware.SessionMiddleware',
58 'django.middleware.common.CommonMiddleware',
59 'django.middleware.csrf.CsrfViewMiddleware',
60 'django.contrib.auth.middleware.AuthenticationMiddleware',
61 'django.contrib.messages.middleware.MessageMiddleware',
62 'django.middleware.clickjacking.XFrameOptionsMiddleware',
63 'apps.fiscalizacao.middleware.Auth',
64]
65
66ROOT_URLCONF = 'cro.urls'
67
68TEMPLATES = [
69 {
70 'BACKEND': 'django.template.backends.django.DjangoTemplates',
71 'DIRS': [os.path.join(PROJECT_ROOT, 'templates')],
72 'APP_DIRS': True,
73 'OPTIONS': {
74 'context_processors': [
75 'django.template.context_processors.debug',
76 'django.template.context_processors.request',
77 'django.contrib.auth.context_processors.auth',
78 'django.contrib.messages.context_processors.messages',
79 'apps.core.context_processors.about',
80 ],
81 },
82 },
83]
84
85WSGI_APPLICATION = 'cro.wsgi.application'
86
87# Database
88# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
89
90DATABASES = {
91 'default': {
92 'ENGINE': 'django.db.backends.%s' % config('DB_ENGINE'),
93 'NAME': config('DB_NAME'),
94 'USER': config('DB_USER'),
95 'PASSWORD': config('DB_PASSWORD'),
96 'HOST': config('DB_HOST', default='localhost'),
97 'PORT': config('DB_PORT'),
98 }
99}
100
101# Password validation
102# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
103
104AUTH_PASSWORD_VALIDATORS = [
105 {
106 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
107 },
108 {
109 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
110 },
111 {
112 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
113 },
114 {
115 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
116 },
117]
118
119AUTH_USER_MODEL = 'fiscalizacao.usuario'
120
121REST_FRAMEWORK = {
122 'DEFAULT_PERMISSION_CLASSES': (
123 'rest_framework.permissions.IsAuthenticated',
124 ),
125 'DEFAULT_AUTHENTICATION_CLASSES': (
126 'rest_framework.authentication.TokenAuthentication',
127 )
128}
129
130# Internationalization
131# https://docs.djangoproject.com/en/2.0/topics/i18n/
132
133LANGUAGE_CODE = 'pt-br'
134
135TIME_ZONE = 'America/Fortaleza'
136
137USE_I18N = True
138
139USE_L10N = True
140
141USE_TZ = False
142
143DATE_INPUT_FORMATS = ['%d/%m/%Y']
144
145# Static files (CSS, JavaScript, Images)
146# https://docs.djangoproject.com/en/2.0/howto/static-files/
147
148LOGIN_REDIRECT_URL = '/'
149LOGOUT_REDIRECT_URL = '/login'
150
151STATIC_URL = '/static/'
152STATIC_ROOT = os.path.join(BASE_DIR, 'static')
153
154MEDIA_URL = '/media/'
155MEDIA_ROOT = os.path.join(BASE_DIR, 'media')