Untitled
raw download clone
PYTHON
views 33
,
size 7312 b
"""
Django settings for portal180graus project.

Generated by 'django-admin startproject' using Django 2.2.9.

For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""

import os
import sys

from decouple import config

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

sys.path.insert(0, os.path.join(BASE_DIR, 'app'))

map(lambda directory: sys.path.insert(0, os.path.join(BASE_DIR, directory)), ['app'])

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'y9pq*w1-z=$c@q86hx2nkzxe&#j2tjie#jn%jr2!*#bwnubxwq'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', cast=bool, default=False)

ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=lambda v: [s.strip() for s in v.split(',')],
                       default='180graus.com')

COMPRESS_ENABLED = config('COMPRESS_ENABLED', cast=bool, default=True)
COMPRESS_CSS_FILTERS = ['compressor.filters.css_default.CssAbsoluteFilter', 'compressor.filters.cssmin.CSSMinFilter']

HTML_MINIFY = config('HTML_MINIFY', cast=bool, default=True)
EXCLUDE_FROM_MINIFYING = ('^noticia/amp/', '^admin/')
KEEP_COMMENTS_ON_MINIFYING = True


INSTALLED_APPS = [
    'jet',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',

    'mptt',
    'logentry_admin',
    'easy_thumbnails',
    'easy_thumbnails.optimize',
    'ckeditor',
    'ckeditor_uploader',
    'haystack',
    'compressor',
    'pure_pagination',

    'website.apps.WebsiteConfig',
    'blog.apps.BlogConfig',
    'cities.apps.CitiesConfig',
    'contact.apps.ContactConfig',
    'feeds.apps.FeedsConfig',
    'flat_pages.apps.FlatPagesConfig',
    'image_bank.apps.ImageBankConfig',
    'news.apps.NewsConfig',
    'poll.apps.PollConfig',
    'report.apps.ReportConfig',
    'sitemap.apps.SitemapConfig',
    'social_network.apps.SocialNetworkConfig',
    'topic.apps.TopicConfig',
    'video.apps.VideoConfig',
    'dfp.apps.DfpConfig'
]
# Application definition


MIDDLEWARE = [
    'htmlmin.middleware.HtmlMinifyMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'htmlmin.middleware.MarkRequestMiddleware',
]

ROOT_URLCONF = 'portal180graus.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')]
        ,
        'APP_DIRS': True,
        'OPTIONS': {
            'debug': DEBUG,
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'portal180graus.wsgi.application'


# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases

# DATABASES = {
#     'default': {
#         'ENGINE': 'django.db.backends.sqlite3',
#         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
#     }
# }

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.{}'.format(config('DB_ENGINE', default='postgresql_psycopg2')),
        'NAME': config('DB_NAME', default='portal180graus'),
        'USER': config('DB_USER', default=''),
        'PASSWORD': config('DB_PASSWORD', default=''),
        'HOST': config('DB_HOST', default=''),
        'CONN_MAX_AGE': 600,  # segundos
        # 'OPTIONS': {'charset': 'utf8mb4'},
    }
}

# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/

SITE_ID = 1

LANGUAGE_CODE = 'pt-BR'

TIME_ZONE = 'America/Fortaleza'

USE_I18N = True

USE_L10N = True

USE_TZ = True

STATIC_URL = '/static/'

MEDIA_URL = '/media/'

MEDIA_ROOT = config('MEDIA_ROOT')

STATIC_ROOT = config(BASE_DIR,'STATIC_ROOT')

STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]

STATICFILES_FINDERS = [
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',
]

SESSION_EXPIRE_AT_BROWSER_CLOSE = True

CKEDITOR_UPLOAD_PATH = 'uploads/'
CKEDITOR_IMAGE_BACKEND = 'pillow'
CKEDITOR_UPLOAD_SLUGIFY_FILENAME = True
CKEDITOR_BROWSE_SHOW_DIRS = True

CKEDITOR_CONFIGS = {
    'default': {
        'toolbar': [
            ['Source', '-', 'Bold', 'Italic', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', '-', 'RemoveFormat',
             'Update', '-', 'Link', 'Unlink', 'TextColor', 'FontSize', '-', 'Find', 'Replace', '-', 'ImageBank',
             'Table', 'Iframe', 'Youtube', 'Html5audio', 'Html5video', 'Embed'],
        ],
        'forcePasteAsPlainText': True,
        'entities': False,
        'htmlEncodeOutput': False,
        'allowedContent': True,
        'extraPlugins': 'youtube,html5audio,html5video,imagebank,embed,wordcount',
        'fillEmptyBlocks': False,
        'width': '100%',
        'contentsCss': ('/static/ckeditor/content.css', '/static/ckeditor/ckeditor/contents.css'),
    },
    'basic': {
        'toolbar': [
            ['Source', '-', 'Bold', 'Italic', '-', 'RemoveFormat', '-', 'Link', 'Unlink', '-', 'Find', 'Replace'],
        ],
        'forcePasteAsPlainText': True,
        'entities': False,
        'htmlEncodeOutput': False,
        'allowedContent': True,
        'fillEmptyBlocks': False,
        'width': '600',
        'contentsCss': ('/static/ckeditor/content.css', '/static/ckeditor/ckeditor/contents.css'),
    },

}

PAGINATION_SETTINGS = {
    'PAGE_RANGE_DISPLAYED': 10,
    'MARGIN_PAGES_DISPLAYED': 2,
    'SHOW_FIRST_PAGE_WHEN_INVALID': True,
}

HAYSTACK_SEARCH_RESULTS_PER_PAGE = 10

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
        'PATH': config('HAYSTACK_ROOT'),
    },
}
close fullscreen
Login or Register to edit or fork this paste. It's free.