· 7 years ago · Nov 09, 2018, 11:20 PM
1"""
2Django settings for snpj project.
3
4Generated by 'django-admin startproject' using Django 1.8.1.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.8/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.8/ref/settings/
11"""
12
13# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
14import os
15
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17# BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 's()bs57t5!cc-x9vt(uj&gupcm7qujam9v$ifamf(dg=)8+pjb'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = [
29 '.edu.br'
30 ]
31SITE_ID = 1
32
33# Login configuration
34LOGIN_REDIRECT_URL = '/adesao/home'
35LOGIN_URL = '/adesao/login'
36LOGOUT_URL = '/adesao/sair'
37SESSION_EXPIRE_AT_BROWSER_CLOSE = True
38
39# E-mail configuration
40DEFAULT_FROM_EMAIL = 'naoresponda@unidesc.edu.br'
41if DEBUG:
42 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
43# else:
44 # EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
45 # EMAIL_HOST = 'correio.cultura.gov.br'
46 # EMAIL_PORT = 25
47 # EMAIL_TIMEOUT = 30
48
49
50# Application definition
51
52DEFAULT_APPS = (
53 'django.contrib.admin',
54 'django.contrib.auth',
55 'django.contrib.contenttypes',
56 'django.contrib.sessions',
57 'django.contrib.sites',
58 'django.contrib.messages',
59 'django.contrib.staticfiles',
60 )
61
62THIRD_PARTY_APPS = (
63 'widget_tweaks',
64 'wkhtmltopdf',
65 'localflavor',
66 'django_extensions',
67 'ckeditor',
68 )
69
70LOCAL_APPS = (
71 'snpj',
72 'adesao',
73 'gestao',
74 )
75
76INSTALLED_APPS = DEFAULT_APPS + THIRD_PARTY_APPS + LOCAL_APPS
77
78MIDDLEWARE_CLASSES = (
79 'django.contrib.sessions.middleware.SessionMiddleware',
80 'django.middleware.common.CommonMiddleware',
81 'django.middleware.csrf.CsrfViewMiddleware',
82 'django.contrib.auth.middleware.AuthenticationMiddleware',
83 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
84 'django.contrib.messages.middleware.MessageMiddleware',
85 'django.middleware.clickjacking.XFrameOptionsMiddleware',
86 'django.middleware.security.SecurityMiddleware',
87 )
88
89ROOT_URLCONF = 'snpj.urls'
90
91TEMPLATES = [
92 {
93 'BACKEND': 'django.template.backends.django.DjangoTemplates',
94 'DIRS': [
95 os.path.join(BASE_DIR, 'templates'),
96 ],
97 'APP_DIRS': True,
98 'OPTIONS': {
99 'context_processors': [
100 'django.template.context_processors.debug',
101 'django.template.context_processors.request',
102 'django.contrib.auth.context_processors.auth',
103 'django.contrib.messages.context_processors.messages',
104 ],
105 },
106 },
107 ]
108
109WSGI_APPLICATION = 'snpj.wsgi.application'
110
111
112# Database
113# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
114
115DATABASES = {
116 'default': {
117 'ENGINE': 'django.db.backends.postgresql_psycopg2',
118 'NAME': 'snpj',
119 'USER': 'postgres',
120 'PASSWORD':'123456',
121 'HOST': 'localhost',
122 'PORT': '5432',
123 }
124 }
125
126
127# Internationalization
128# https://docs.djangoproject.com/en/1.8/topics/i18n/
129
130LANGUAGE_CODE = 'pt-br'
131
132TIME_ZONE = 'America/Sao_Paulo'
133
134USE_I18N = True
135
136USE_L10N = True
137
138USE_TZ = True
139
140LOCALE_PATHS = (
141 os.path.join(BASE_DIR, 'locale'),
142 )
143
144
145# Static files (CSS, JavaScript, Images)
146# https://docs.djangoproject.com/en/1.8/howto/static-files/
147def ABS_DIR(rel):
148 return os.path.join(BASE_DIR, rel.replace('/', os.path.sep))
149
150MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
151MEDIA_URL = '/media/'
152STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
153STATIC_URL = '/static/'
154
155# Smart selects
156USE_DJANGO_JQUERY = False
157JQUERY_URL = STATIC_URL + 'js/jquery.min.js'
158
159# CKEditor
160CKEDITOR_JQUERY_URL = JQUERY_URL
161CKEDITOR_UPLOAD_PATH = "uploads/"
162CKEDITOR_CONFIGS = {
163 'default': {
164 'toolbar': 'Custom',
165 'toolbar_Custom': [
166 ['Bold', 'Italic', 'Underline'],
167 ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
168 ['Link', 'Unlink'],
169 ['RemoveFormat', 'Source']
170 ]
171 },
172 }