You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
191 lines
5.0 KiB
191 lines
5.0 KiB
"""
|
|
Django settings for Eshop project.
|
|
|
|
Generated by 'django-admin startproject' using Django 1.10.6.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/1.10/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/1.10/ref/settings/
|
|
"""
|
|
|
|
import os
|
|
from .env import env
|
|
|
|
# Site basic settings
|
|
|
|
SITE_HOST = env.str('SITE_HOST')
|
|
SITE_URL_HTTP = 'http://{}'.format(SITE_HOST)
|
|
SITE_URL_HTTPS = 'https://{}'.format(SITE_HOST)
|
|
DEFAULT_SITE_URL = SITE_URL_HTTPS if env.bool('USE_SSL', default=False) else SITE_URL_HTTP
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = env.str('SECRET_KEY')
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = env.bool('DEBUG')
|
|
|
|
ALLOWED_HOSTS = tuple(env.list('ALLOWED_HOSTS', default=[]))
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'suit',
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'django.contrib.postgres',
|
|
'debug_toolbar',
|
|
|
|
'import_export',
|
|
'djcelery_email',
|
|
'mptt',
|
|
'landing',
|
|
'orders',
|
|
'loginsys',
|
|
'core',
|
|
'products',
|
|
'cart',
|
|
'discount',
|
|
'djcelery'
|
|
|
|
]
|
|
|
|
MIDDLEWARE = [
|
|
'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',
|
|
]
|
|
|
|
ROOT_URLCONF = 'eshop_project.urls'
|
|
|
|
TEMPLATES = [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [os.path.join(BASE_DIR, 'templates')],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.request',
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.contrib.messages.context_processors.messages',
|
|
'cart.context_processors.cart',
|
|
# 'orders.context_processors.getting_basket_info',
|
|
],
|
|
},
|
|
},
|
|
]
|
|
|
|
WSGI_APPLICATION = 'eshop_project.wsgi.application'
|
|
|
|
MPTT_ADMIN_LEVEL_INDENT = 20
|
|
# Database
|
|
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'extra': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': os.path.join(BASE_DIR,'eshop.sqlite')
|
|
}
|
|
}
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/1.10/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/1.10/topics/i18n/
|
|
|
|
LANGUAGE_CODE = 'ru-RU'
|
|
|
|
DATE_FORMAT = 'd E Y'
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/1.10/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
STATICFILES_DIRS = (
|
|
os.path.join(BASE_DIR, "static", "static_dev"),
|
|
)
|
|
|
|
STATIC_ROOT = os.path.join(BASE_DIR, "static/") # , "static_dev")
|
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, "static", "media")
|
|
|
|
AUTH_PROFILE_MODULE = 'core.UserProfile'
|
|
|
|
CART_SESSION_ID = 'cart'
|
|
|
|
|
|
# Email server settings
|
|
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
|
|
EMAIL_FILE_PATH = '/tmp/eshop-messages'
|
|
|
|
# CELERY SETTINGS
|
|
import djcelery
|
|
|
|
djcelery.setup_loader()
|
|
|
|
BROKER_URL = 'amqp://localhost'
|
|
# BROKER_URL = 'amqp://78.155.219.170'
|
|
# BROKER_USER = "django_shop"
|
|
# BROKER_PASSWORD = "django_shop12345"
|
|
|
|
# for import-export excel data
|
|
IMPORT_EXPORT_USE_TRANSACTIONS = True
|
|
|
|
# WHOOSH_INDEX = os.path.join(os.path.dirname(__file__), "whoosh/")
|
|
|
|
# Uncomment for elasticsearch
|
|
|
|
# HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
|
|
# HAYSTACK_SEARCH_RESULTS_PER_PAGE = 12
|
|
# HAYSTACK_CONNECTIONS = {
|
|
# 'default': {
|
|
# 'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
|
|
# 'URL': 'http://127.0.0.1:9200',
|
|
# 'INDEX_NAME': 'haystack',
|
|
# # 'INCLUDE_SPELLING': True,
|
|
# },
|
|
# }
|
|
# STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
|
|
|