Snippets
Created by
Guilherme Carvalho
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | # -*- coding:utf-8 -*-
import locale
import os
LOCAL = os.path.dirname(os.path.abspath(__file__))
# New Settings
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = False
ADMINS = (
('Guilherme de Carvalho Carneiro', 'guilherme.carvalho@xxxxxxxxx.com.br'),
)
MANAGERS = ADMINS
ALLOWED_HOSTS = ['.meudominio.com.br', ]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'desenvolvimento',
'USER': 'desenvolvimento',
'PASSWORD': 'desenvolvimento',
'HOST': '',
'PORT': '',
}
}
TIME_ZONE = 'UTC'
LANGUAGE_CODE = 'pt-br'
SITE_ID = 1
USE_I18N = True
USE_L10N = True
USE_TZ = True
MEDIA_ROOT = os.path.join(LOCAL, 'media')
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(LOCAL, 'static')
STATIC_URL = '/static/'
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(LOCAL, 'templates')],
'OPTIONS': {
'debug': DEBUG,
'context_processors': [
'base.processors.applist',
'base.processors.user_menu',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
],
},
},
]
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'wsgi.application'
INSTALLED_APPS = (
'adminboot',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
...,
'rest_framework',
'rest_framework.authtoken',
'apirestfull',
)
# Settings para RESTFull
REST_FRAMEWORK = {
# Use hyperlinked styles by default.
# Only used if the `serializer_class` attribute is not set on a view.
'DEFAULT_MODEL_SERIALIZER_CLASS':
'rest_framework.serializers.HyperlinkedModelSerializer',
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',
'rest_framework.filters.SearchFilter', ),
# Use Django's standard `django.contrib.auth` permissions,
# or allow read-only access for unauthenticated users.
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
),
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticatedOrReadOnly',
)
}
#
EMAIL_HOST = 'xxxxxxxx'
EMAIL_HOST_USER = 'xxx@xxx.xx.xx'
EMAIL_HOST_PASSWORD = 'xxxxxxxxxx'
EMAIL_PORT = 'xxx'
EMAIL_USE_TLS = True
EMAIL_SUBJECT_PREFIX = 'xxxxxxx'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
|
Comments (0)
You can clone a snippet to your computer for local editing. Learn more.