311 lines
8.2 KiB
Python
311 lines
8.2 KiB
Python
"""
|
|
Django settings for rowsandall_app project.
|
|
|
|
Generated by 'django-admin startproject' using Django 1.9.5.
|
|
|
|
For more information on this file, see
|
|
https://docs.djangoproject.com/en/1.9/topics/settings/
|
|
|
|
For the full list of settings and their values, see
|
|
https://docs.djangoproject.com/en/1.9/ref/settings/
|
|
"""
|
|
# -*- coding: utf-8 -*-
|
|
import os
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
|
|
DEFAULT_CHARSET = 'UTF-8'
|
|
|
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
|
|
# Quick-start development settings - unsuitable for production
|
|
# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
|
|
|
|
# SECURITY WARNING: keep the secret key used in production secret!
|
|
SECRET_KEY = 'z_@2yia858=2i1cygo4ne3+14&i_&@wlty68$q1igdvn=9k5mo'
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
DEBUG = False
|
|
|
|
ALLOWED_HOSTS = ['rowsandall.com','rowsandall-1072.rostiapp.cz']
|
|
|
|
|
|
# Application definition
|
|
|
|
INSTALLED_APPS = [
|
|
'django.contrib.admin',
|
|
'django.contrib.auth',
|
|
'django.contrib.contenttypes',
|
|
'django.contrib.sessions',
|
|
'django.contrib.messages',
|
|
'django.contrib.staticfiles',
|
|
'rowers',
|
|
'cvkbrno',
|
|
'django_rq',
|
|
'translation_manager',
|
|
# 'debug_toolbar',
|
|
'django_mailbox',
|
|
'rest_framework',
|
|
'rest_framework_swagger',
|
|
'oauth2_provider',
|
|
'corsheaders',
|
|
'analytical',
|
|
'cookielaw'
|
|
]
|
|
|
|
AUTHENTICATION_BACKENDS = (
|
|
'oauth2_provider.backends.OAuth2Backend',
|
|
# Uncomment following if you want to access the admin
|
|
'django.contrib.auth.backends.ModelBackend',
|
|
)
|
|
|
|
MIDDLEWARE_CLASSES = [
|
|
'django.middleware.gzip.GZipMiddleware',
|
|
# 'htmlmin.middleware.HtmlMinifyMiddleware',
|
|
'htmlmin.middleware.MarkRequestMiddleware',
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
|
'django.middleware.security.SecurityMiddleware',
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
'django.middleware.locale.LocaleMiddleware',
|
|
'corsheaders.middleware.CorsMiddleware',
|
|
'django.middleware.common.CommonMiddleware',
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
|
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
|
'oauth2_provider.middleware.OAuth2TokenMiddleware',
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
|
# 'debug_toolbar.middleware.DebugToolbarMiddleware',
|
|
]
|
|
|
|
ROOT_URLCONF = 'rowsandall_app.urls'
|
|
#HTML_MINIFY = True
|
|
|
|
#EXCLUDE_FROM_MINIFYING = ('^rowers/flexall',
|
|
# '^rowers/list-workouts',
|
|
# '^rowers/list-graphs',
|
|
# '^admin/',
|
|
# '^rowers/histo')
|
|
|
|
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.core.context_processors.request',
|
|
'django.contrib.auth.context_processors.auth',
|
|
'django.contrib.messages.context_processors.messages',
|
|
'django.template.context_processors.i18n',
|
|
],
|
|
# 'loaders': [
|
|
# 'django.template.loaders.app_directories.Loader',
|
|
# ],
|
|
},
|
|
|
|
},
|
|
]
|
|
|
|
|
|
CORS_ORIGIN_ALLOW_ALL = True
|
|
|
|
WSGI_APPLICATION = 'rowsandall_app.wsgi.application'
|
|
|
|
|
|
# Database
|
|
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
|
|
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.mysql',
|
|
'NAME': 'rowsanda_107501',
|
|
'USER': 'rowsanda_107501',
|
|
'PASSWORD': 'roeidata',
|
|
'HOST': 'store3.rosti.cz',
|
|
'PORT': '3306',
|
|
},
|
|
'slave': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
|
},
|
|
'TEST': {
|
|
'CHARSET': 'utf8',
|
|
'COLLATION': 'utf8_general_ci',
|
|
},
|
|
}
|
|
|
|
|
|
# Password validation
|
|
# https://docs.djangoproject.com/en/1.9/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.9/topics/i18n/
|
|
|
|
TIME_ZONE = 'UTC'
|
|
|
|
USE_I18N = True
|
|
|
|
USE_L10N = True
|
|
|
|
USE_TZ = True
|
|
|
|
LOCALE_PATHS = (
|
|
os.path.join(BASE_DIR, 'locale'),
|
|
os.path.join(BASE_DIR, 'cvkbrno/locale'),
|
|
)
|
|
|
|
LANGUAGES = (
|
|
('cs',_(u'Czech')),
|
|
('nl',_(u'Dutch'))
|
|
)
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
|
LANGUAGE_COOKIE_NAME = 'wm_lang'
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
# https://docs.djangoproject.com/en/1.9/howto/static-files/
|
|
|
|
STATIC_URL = '/static/'
|
|
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
|
|
|
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'),
|
|
os.path.join(BASE_DIR, 'static/plots'),]
|
|
|
|
MEDIA_URL = '/media/'
|
|
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
|
|
|
|
|
|
|
# user authentication
|
|
|
|
# user authentication
|
|
LOGIN_REDIRECT_URL = '/rowers/list-workouts/'
|
|
LOGIN_URL = '/login/'
|
|
LOGOUT_URL = '/logout/'
|
|
|
|
# Concept 2
|
|
C2_CLIENT_ID = "bgTBbmjSyn8wbJb0JEdlYjDUfSZFAPQSzJV8YDwH"
|
|
C2_CLIENT_SECRET = "HD6HnEu8bFWGkrpGoa89kliXhofLzAHzllltWMPg"
|
|
C2_REDIRECT_URI = "http://rowsandall.com/call_back"
|
|
|
|
# Strava
|
|
|
|
STRAVA_CLIENT_ID = "11567"
|
|
STRAVA_CLIENT_SECRET = "9e55d439879e1da6724e75e4a3220b35a493fe24"
|
|
STRAVA_REDIRECT_URI = "http://rowsandall.com/stravacall_back"
|
|
|
|
# SportTracks
|
|
|
|
SPORTTRACKS_CLIENT_ID = "rowingdata"
|
|
SPORTTRACKS_CLIENT_SECRET = "3GZVXH8GB4PZQHPD"
|
|
SPORTTRACKS_REDIRECT_URI = "http://rowsandall.com/sporttracks_callback"
|
|
|
|
# RQ stuff
|
|
|
|
RQ_QUEUES = {
|
|
'default': {
|
|
'HOST': 'localhost',
|
|
'PORT': 6379,
|
|
'DB': 0,
|
|
# 'PASSWORD': 'some-password',
|
|
'DEFAULT_TIMEOUT': 360,
|
|
},
|
|
'low': {
|
|
'HOST': 'localhost',
|
|
'PORT': 6379,
|
|
'DB': 0,
|
|
# 'PASSWORD': 'some-password',
|
|
'DEFAULT_TIMEOUT': 360,
|
|
},
|
|
}
|
|
|
|
|
|
#SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
|
|
#SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
|
|
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
|
|
|
|
# email stuff
|
|
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
EMAIL_HOST = 'mail.rosti.cz'
|
|
EMAIL_PORT = '25'
|
|
EMAIL_HOST_USER = 'info@rowsandall.com'
|
|
#EMAIL_HOST_PASSWORD = 'lnD3mbZ1NoI8RK1StOdO'
|
|
EMAIL_HOST_PASSWORD = '0r0wYgQUReOYK7sEkBby'
|
|
EMAIL_USE_TLS = True
|
|
|
|
# weather stuff
|
|
|
|
FORECAST_IO_KEY = "bc8196fbd89f11375c7dfc8aa6323c72"
|
|
GMAPIKEY = "AIzaSyAgu1w9QSthaGPMLp8y9JedPoMc9sfEgJ8"
|
|
|
|
# OAUTH2
|
|
|
|
OAUTH2_PROVIDER = {
|
|
# this is the list of available scopes
|
|
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'},
|
|
# 'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore'
|
|
}
|
|
|
|
|
|
# REST Framework
|
|
|
|
REST_FRAMEWORK = {
|
|
# Use Django's standard `django.contrib.auth` permissions,
|
|
# or allow read-only access for unauthenticated users.
|
|
'DEFAULT_PERMISSION_CLASSES': [
|
|
'rest_framework.permissions.IsAuthenticated'
|
|
# 'rest_framework.permissions.DjangoModelPermissions'
|
|
],
|
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
|
'rest_framework.authentication.BasicAuthentication',
|
|
'rest_framework.authentication.SessionAuthentication',
|
|
'oauth2_provider.ext.rest_framework.OAuth2Authentication',
|
|
),
|
|
'PAGE_SIZE': 20,
|
|
}
|
|
|
|
SWAGGER_SETTINGS = {
|
|
'SECURITY_DEFINITION': {
|
|
'basic': {
|
|
'type':'basic'
|
|
},
|
|
'oauth2': {
|
|
'type':'oauth2',
|
|
'authorizationUrl':'/rowers/o/authorize',
|
|
'flow': 'implicit',
|
|
}
|
|
},
|
|
'SHOW_REQUEST_HEADERS': True,
|
|
}
|
|
|
|
# Analytics
|
|
|
|
CLICKY_SITE_ID = '101011008'
|
|
|
|
TWEET_ACCESS_TOKEN_KEY = "792366179780268032-tlk7QofNsx7GlNzefmHUzmxcpTITzyO"
|
|
TWEET_ACCESS_TOKEN_SECRET = "sOhEZ1GyQ9ROzgmAKoNfQIjWaOKMMSgP03EIJuuIvLGRc"
|
|
TWEET_CONSUMER_KEY = "gtXQGCMN98dnF6eut2F5xtDET"
|
|
TWEET_CONSUMER_SECRET = "rS78fNy1E075bssAoZl45QJN27X7XoYhnhSFgvqpJ5V7d5R8Wp"
|
|
|