more pep
This commit is contained in:
@@ -1 +0,0 @@
|
||||
|
||||
|
||||
@@ -1,5 +1 @@
|
||||
|
||||
from django import forms
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from django.db import models
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
from YamJam import yamjam
|
||||
#from django.utils.translation import ugettext_lazy as _
|
||||
# from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
# Read configuration (passwords, keys, secrets) from YamJam configuration
|
||||
# You have to create your own config.yaml in the project directory
|
||||
@@ -20,8 +20,6 @@ CFG = yamjam()['rowsandallapp']
|
||||
|
||||
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__)))
|
||||
|
||||
@@ -39,10 +37,10 @@ TESTING = False
|
||||
|
||||
ALLOWED_HOSTS = CFG['allowed_hosts']
|
||||
|
||||
#OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL = 'oauth2_provider.AccessToken'
|
||||
#OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application'
|
||||
#OAUTH2_PROVIDER_REFRESH_TOKEN_MODEL = 'oauth2_provider.RefreshToken'
|
||||
#OAUTH2_PROVIDER_ACCESS_TOKEN_EXPIRE_SECONDS = 3600
|
||||
# OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL = 'oauth2_provider.AccessToken'
|
||||
# OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application'
|
||||
# OAUTH2_PROVIDER_REFRESH_TOKEN_MODEL = 'oauth2_provider.RefreshToken'
|
||||
# OAUTH2_PROVIDER_ACCESS_TOKEN_EXPIRE_SECONDS = 3600
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
@@ -51,20 +49,20 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
INSTALLED_APPS = [
|
||||
'rowers',
|
||||
'survey',
|
||||
# 'cvkbrno',
|
||||
# 'cvkbrno',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
# 'suit',
|
||||
# 'suit_rq',
|
||||
# 'suit',
|
||||
# 'suit_rq',
|
||||
'leaflet',
|
||||
'django_rq',
|
||||
# 'django_rq_dashboard',
|
||||
# 'translation_manager',
|
||||
# 'django_mailbox',
|
||||
# 'django_rq_dashboard',
|
||||
# 'translation_manager',
|
||||
# 'django_mailbox',
|
||||
'rest_framework',
|
||||
'datetimewidget',
|
||||
'rest_framework_swagger',
|
||||
@@ -91,12 +89,12 @@ MIDDLEWARE = [
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.common.BrokenLinkEmailsMiddleware',
|
||||
'django.middleware.gzip.GZipMiddleware',
|
||||
# 'htmlmin.middleware.HtmlMinifyMiddleware',
|
||||
# 'htmlmin.middleware.MarkRequestMiddleware',
|
||||
# 'htmlmin.middleware.HtmlMinifyMiddleware',
|
||||
# 'htmlmin.middleware.MarkRequestMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
# 'django.middleware.locale.LocaleMiddleware',
|
||||
# 'django.middleware.locale.LocaleMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
@@ -106,14 +104,14 @@ MIDDLEWARE = [
|
||||
'tz_detect.middleware.TimezoneMiddleware',
|
||||
'rowers.middleware.SurveyMiddleWare',
|
||||
'rowers.middleware.GDPRMiddleWare',
|
||||
# 'rowers.middleware.PowerTimeFitnessMetricMiddleWare',
|
||||
# 'rowers.middleware.PowerTimeFitnessMetricMiddleWare',
|
||||
'rowers.middleware.RowerPlanMiddleWare',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'rowsandall_app.urls'
|
||||
HTML_MINIFY = True
|
||||
|
||||
#EXCLUDE_FROM_MINIFYING = ('^rowers/flexall',
|
||||
# EXCLUDE_FROM_MINIFYING = ('^rowers/flexall',
|
||||
# '^rowers/list-workouts',
|
||||
# '^rowers/list-graphs',
|
||||
# '^admin/',
|
||||
@@ -124,7 +122,7 @@ APPEND_SLASH = True
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR,'templates')],
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates')],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
@@ -132,19 +130,18 @@ TEMPLATES = [
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
'django.template.context_processors.i18n',
|
||||
# 'context_processors.google_analytics',
|
||||
'django.template.context_processors.i18n',
|
||||
# 'context_processors.google_analytics',
|
||||
'context_processors.warning_message',
|
||||
'rowers.context_processors.braintree_merchant',
|
||||
],
|
||||
'libraries' : {
|
||||
'libraries': {
|
||||
'staticfiles': 'django.templatetags.static',
|
||||
}
|
||||
# 'loaders': [
|
||||
# 'django.template.loaders.app_directories.Loader',
|
||||
# ],
|
||||
# 'loaders': [
|
||||
# 'django.template.loaders.app_directories.Loader',
|
||||
# ],
|
||||
},
|
||||
|
||||
},
|
||||
]
|
||||
|
||||
@@ -177,8 +174,8 @@ DATABASES = {
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
},
|
||||
'TEST': {
|
||||
'CHARSET': 'utf8',
|
||||
'COLLATION': 'utf8_general_ci',
|
||||
'CHARSET': 'utf8',
|
||||
'COLLATION': 'utf8_general_ci',
|
||||
},
|
||||
}
|
||||
|
||||
@@ -192,9 +189,9 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
'OPTIONS': {
|
||||
'min_length': 9,
|
||||
}
|
||||
'OPTIONS': {
|
||||
'min_length': 9,
|
||||
}
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
@@ -203,7 +200,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'rowers.validator.LettersAndDigitsValidator',
|
||||
'NAME': 'rowers.validator.LettersAndDigitsValidator',
|
||||
}
|
||||
]
|
||||
|
||||
@@ -217,11 +214,11 @@ USE_I18N = True
|
||||
USE_L10N = False
|
||||
|
||||
DATE_INPUT_FORMATS = [
|
||||
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
|
||||
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
|
||||
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
|
||||
'%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
|
||||
'%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
|
||||
'%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
|
||||
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
|
||||
'%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
|
||||
'%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
|
||||
'%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
|
||||
]
|
||||
|
||||
DATE_FORMAT = 'Y-m-d'
|
||||
@@ -229,12 +226,12 @@ DATE_FORMAT = 'Y-m-d'
|
||||
USE_TZ = True
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
TZ_DETECT_COUNTRIES = ('US','DE','GB','CZ','FR','IT')
|
||||
TZ_DETECT_COUNTRIES = ('US', 'DE', 'GB', 'CZ', 'FR', 'IT')
|
||||
|
||||
LOCALE_PATHS = (
|
||||
os.path.join(BASE_DIR, 'locale'),
|
||||
# os.path.join(BASE_DIR, 'cvkbrno/locale'),
|
||||
)
|
||||
# os.path.join(BASE_DIR, 'cvkbrno/locale'),
|
||||
)
|
||||
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
@@ -244,19 +241,16 @@ LANGUAGE_COOKIE_NAME = 'wm_lang'
|
||||
# https://docs.djangoproject.com/en/1.9/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
#STATIC_ROOT = BASE_DIR
|
||||
# STATIC_ROOT = BASE_DIR
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
|
||||
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static/plots'),]
|
||||
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static/plots'), ]
|
||||
# os.path.join(BASE_DIR, 'static'),
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
|
||||
|
||||
# user authentication
|
||||
|
||||
# user authentication
|
||||
LOGIN_REDIRECT_URL = '/rowers/list-workouts/'
|
||||
LOGIN_URL = '/login/'
|
||||
@@ -268,18 +262,18 @@ LOGOUT_REDIRECT_URL = '/'
|
||||
PROGRESS_CACHE_SECRET = CFG['progress_cache_secret']
|
||||
try:
|
||||
UPLOAD_SERVICE_URL = CFG['upload_service_url']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
UPLOAD_SERVICE_URL = "http://localhost:8000/rowers/workout/api/upload/"
|
||||
try:
|
||||
UPLOAD_SERVICE_SECRET = CFG['upload_service_secret']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
UPLOAD_SERVICE_SECRET = "FoYezZWLSyfAVimumpHEeYsJjsNCerxV"
|
||||
|
||||
# Concept 2
|
||||
C2_CLIENT_ID = CFG['c2_client_id']
|
||||
C2_CLIENT_SECRET = CFG['c2_client_secret']
|
||||
C2_REDIRECT_URI = CFG['c2_callback']
|
||||
#C2_REDIRECT_URI = "http://localhost:8000/call_back"
|
||||
# C2_REDIRECT_URI = "http://localhost:8000/call_back"
|
||||
|
||||
# Strava
|
||||
|
||||
@@ -316,8 +310,8 @@ UNDERARMOUR_CLIENT_ID = CFG['underarmour_client_name']
|
||||
UNDERARMOUR_CLIENT_SECRET = CFG['underarmour_client_secret']
|
||||
UNDERARMOUR_CLIENT_KEY = CFG['underarmour_client_key']
|
||||
UNDERARMOUR_REDIRECT_URI = CFG['underarmour_callback']
|
||||
#UNDERARMOUR_REDIRECT_URI = "http://rowsandall.com/underarmour_callback"
|
||||
#UNDERARMOUR_REDIRECT_URI = "http://localhost:8000/underarmour_callback"
|
||||
# UNDERARMOUR_REDIRECT_URI = "http://rowsandall.com/underarmour_callback"
|
||||
# UNDERARMOUR_REDIRECT_URI = "http://localhost:8000/underarmour_callback"
|
||||
|
||||
# TrainingPeaks
|
||||
TP_CLIENT_ID = CFG["tp_client_id"]
|
||||
@@ -349,56 +343,56 @@ RQ_QUEUES = {
|
||||
'HOST': 'localhost',
|
||||
'PORT': 6379,
|
||||
'DB': 0,
|
||||
# 'PASSWORD': 'some-password',
|
||||
# 'PASSWORD': 'some-password',
|
||||
'DEFAULT_TIMEOUT': 360,
|
||||
},
|
||||
'low': {
|
||||
'HOST': 'localhost',
|
||||
'PORT': 6379,
|
||||
'DB': 0,
|
||||
# 'PASSWORD': 'some-password',
|
||||
# 'PASSWORD': 'some-password',
|
||||
'DEFAULT_TIMEOUT': 360,
|
||||
},
|
||||
'high': {
|
||||
'HOST': 'localhost',
|
||||
'PORT': 6379,
|
||||
'DB': 0,
|
||||
# 'PASSWORD': 'some-password',
|
||||
# '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.signed_cookies"
|
||||
# SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
|
||||
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
|
||||
SESSION_SAVE_EVERY_REQUEST = True
|
||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
||||
|
||||
# admin stuff for error reporting
|
||||
SERVER_EMAIL='admin@rowsandall.com'
|
||||
ADMINS = [('Sander','roosendaalsander@gmail.com')]
|
||||
SERVER_EMAIL = 'admin@rowsandall.com'
|
||||
ADMINS = [('Sander', 'roosendaalsander@gmail.com')]
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||
'LOCATION': 'localhost:11211',
|
||||
'TIMEOUT': 900,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CACHE_MIDDLEWARE_ALIAS = 'default'
|
||||
CACHE_MIDDLEWARE_SECONDS = 900
|
||||
|
||||
# email stuff
|
||||
|
||||
#EMAIL_BACKEND = CFG['email_backend']
|
||||
#EMAIL_HOST = CFG['email_host']
|
||||
#EMAIL_PORT = CFG['email_port']
|
||||
#EMAIL_HOST_USER = CFG['email_host_user']
|
||||
#EMAIL_HOST_PASSWORD = CFG['email_host_password']
|
||||
#EMAIL_USE_TLS = CFG['email_use_tls']
|
||||
#DEFAULT_FROM_EMAIL = 'admin@rowsandall.com'
|
||||
# EMAIL_BACKEND = CFG['email_backend']
|
||||
# EMAIL_HOST = CFG['email_host']
|
||||
# EMAIL_PORT = CFG['email_port']
|
||||
# EMAIL_HOST_USER = CFG['email_host_user']
|
||||
# EMAIL_HOST_PASSWORD = CFG['email_host_password']
|
||||
# EMAIL_USE_TLS = CFG['email_use_tls']
|
||||
# DEFAULT_FROM_EMAIL = 'admin@rowsandall.com'
|
||||
|
||||
EMAIL_BACKEND = 'django_ses.SESBackend'
|
||||
|
||||
@@ -407,7 +401,7 @@ AWS_SES_REGION_ENDPOINT = CFG['aws_smtp']
|
||||
|
||||
AWS_SES_ACCESS_KEY_ID = CFG['aws_access_key_id']
|
||||
AWS_SES_SECRET_ACCESS_KEY = CFG['aws_secret_access_key']
|
||||
AWS_ACCESS_KEY_ID = CFG['aws_access_key_id']
|
||||
AWS_ACCESS_KEY_ID = CFG['aws_access_key_id']
|
||||
AWS_SECRET_ACCESS_KEY = CFG['aws_secret_access_key']
|
||||
|
||||
EMAIL_HOST = CFG['aws_smtp']
|
||||
@@ -435,7 +429,7 @@ OAUTH2_PROVIDER = {
|
||||
'APPLICATION_MODEL': 'oauth2_provider.Application',
|
||||
'REFRESH_TOKEN_MODEL': 'oauth2_provider.RefreshToken',
|
||||
'ACCESS_TOKEN_EXPIRE_SECONDS': 36000,
|
||||
#'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore'
|
||||
# 'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore'
|
||||
}
|
||||
|
||||
|
||||
@@ -446,38 +440,38 @@ REST_FRAMEWORK = {
|
||||
# or allow read-only access for unauthenticated users.
|
||||
'DEFAULT_PERMISSION_CLASSES': [
|
||||
'rest_framework.permissions.IsAuthenticated'
|
||||
# 'rest_framework.permissions.DjangoModelPermissions'
|
||||
# 'rest_framework.permissions.DjangoModelPermissions'
|
||||
],
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||
'rest_framework.authentication.BasicAuthentication',
|
||||
# 'rest_framework.authentication.SessionAuthentication',
|
||||
# 'rest_framework.authentication.TokenAuthentication',
|
||||
# 'rest_framework.authentication.SessionAuthentication',
|
||||
# 'rest_framework.authentication.TokenAuthentication',
|
||||
'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
|
||||
),
|
||||
'PAGE_SIZE': 20,
|
||||
'DEFAULT_PAGINATION_CLASS':'rest_framework.pagination.LimitOffsetPagination',
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
|
||||
}
|
||||
|
||||
SWAGGER_SETTINGS = {
|
||||
'SECURITY_DEFINITIONS': {
|
||||
'basic': {
|
||||
'type':'basic'
|
||||
},
|
||||
'type': 'basic'
|
||||
},
|
||||
'oauth2': {
|
||||
'type':'oauth2',
|
||||
'authorizationUrl':'/rowers/o/authorize',
|
||||
'type': 'oauth2',
|
||||
'authorizationUrl': '/rowers/o/authorize',
|
||||
'flow': 'implicit',
|
||||
},
|
||||
'api_key': {
|
||||
},
|
||||
'api_key': {
|
||||
'type': 'apiKey',
|
||||
'in': 'header',
|
||||
'name': 'Authorization'
|
||||
},
|
||||
},
|
||||
},
|
||||
'SHOW_REQUEST_HEADERS': True,
|
||||
'USE_SESSION_AUTH': True,
|
||||
'JSON_EDITOR': True,
|
||||
}
|
||||
}
|
||||
|
||||
# Analytics
|
||||
|
||||
@@ -511,75 +505,75 @@ except KeyError:
|
||||
|
||||
try:
|
||||
BRAINTREE_MERCHANT_ID = CFG['braintree_merchant_id']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
BRAINTREE_MERCHANT_ID = ''
|
||||
|
||||
try:
|
||||
BRAINTREE_MERCHANT_ACCOUNT_ID = CFG['braintree_merchant_account_id']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
BRAINTREE_MERCHANT_ACCOUNT_ID = 'rowsandallEUR'
|
||||
|
||||
try:
|
||||
BRAINTREE_PUBLIC_KEY = CFG['braintree_public_key']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
BRAINTREE_PUBLIC_KEY = ''
|
||||
|
||||
try:
|
||||
BRAINTREE_PRIVATE_KEY = CFG['braintree_private_key']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
BRAINTREE_PRIVATE_KEY = ''
|
||||
|
||||
try:
|
||||
BRAINTREE_SANDBOX_MERCHANT_ID = CFG['braintree_sandbox_merchant_id']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
BRAINTREE_SANDBOX_MERCHANT_ID = ''
|
||||
|
||||
try:
|
||||
BRAINTREE_SANDBOX_PUBLIC_KEY = CFG['braintree_sandbox_public_key']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
BRAINTREE_SANDBOX_PUBLIC_KEY = ''
|
||||
|
||||
try:
|
||||
BRAINTREE_SANDBOX_PRIVATE_KEY = CFG['braintree_sandbox_private_key']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
BRAINTREE_SANDBOX_PRIVATE_KEY = ''
|
||||
|
||||
try:
|
||||
PAYMENT_PROCESSING_ON = CFG['payment_processing_on']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
PAYMENT_PROCESSING_ON = False
|
||||
|
||||
try:
|
||||
FAKTUROID_API_KEY = CFG['fakturoid_api_key']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
FAKTUROID_API_KEY = ''
|
||||
|
||||
try:
|
||||
FAKTUROID_EMAIL = CFG['fakturoid_email']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
FAKTUROID_EMAIL = ''
|
||||
|
||||
try:
|
||||
FAKTUROID_SLUG = CFG['fakturoid_slug']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
FAKTUROID_SLUG = ''
|
||||
|
||||
# ID obfuscation
|
||||
try:
|
||||
OPAQUE_SECRET_KEY = CFG['opaque_secret_key']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
OPAQUE_SECRET_KEY = 0xa193443a
|
||||
|
||||
# Celery or RQ
|
||||
try:
|
||||
CELERY = CFG['use_celery']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
CELERY = False
|
||||
|
||||
try:
|
||||
WORKOUTS_FIT_TOKEN = CFG['workouts_fit_token']
|
||||
WORKOUTS_FIT_URL = CFG['workouts_fit_url']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
WORKOUTS_FIT_TOKEN = 'aapnootmies'
|
||||
WORKOUTS_FIT_URL = 'http://localhost:50053/tojson'
|
||||
|
||||
@@ -588,7 +582,7 @@ except KeyError: # pragma: no cover
|
||||
try:
|
||||
RECAPTCHA_SITE_KEY = CFG['recaptcha_site_key']
|
||||
RECAPTCHA_SITE_SECRET = CFG['recaptcha_site_secret']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
RECAPTCHA_SITE_KEY = ''
|
||||
RECAPTCHA_SITE_SECRET = ''
|
||||
|
||||
|
||||
@@ -14,15 +14,13 @@ import sys
|
||||
|
||||
try:
|
||||
use_sqlite = CFG['use_sqlite']
|
||||
except KeyError: # pragma: no cover
|
||||
except KeyError: # pragma: no cover
|
||||
use_sqlite = False
|
||||
|
||||
for element in sys.argv:
|
||||
if 'test' in element:
|
||||
TESTING = True
|
||||
|
||||
|
||||
|
||||
if TESTING or use_sqlite:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
@@ -31,7 +29,8 @@ if TESTING or use_sqlite:
|
||||
'HOST': 'localhost',
|
||||
'USER': '',
|
||||
'PASSWORD': 'roeidata',
|
||||
'PORT': '3306', },
|
||||
'PORT': '3306',
|
||||
},
|
||||
# 'TEST': {
|
||||
# 'CHARSET': 'utf8',
|
||||
# 'COLLATION': 'utf8_general_ci',
|
||||
@@ -42,7 +41,7 @@ if TESTING or use_sqlite:
|
||||
# 'NAME': 'rowsanda_107501',
|
||||
# 'USER': 'rowsanda_107501',
|
||||
|
||||
# }
|
||||
# }
|
||||
}
|
||||
|
||||
|
||||
@@ -63,10 +62,10 @@ DEBUG = True
|
||||
|
||||
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
|
||||
|
||||
ALLOWED_HOSTS = ['localhost','127.0.0.1','dunav.ngrok.io']
|
||||
ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'dunav.ngrok.io']
|
||||
|
||||
# INSTALLED_APPS += ['debug_toolbar',]
|
||||
#INSTALLED_APPS += ["sslserver"]
|
||||
# INSTALLED_APPS += ["sslserver"]
|
||||
|
||||
# MIDDLEWARE_CLASSES += ['debug_toolbar.middleware.DebugToolbarMiddleware',]
|
||||
|
||||
@@ -74,18 +73,20 @@ CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
|
||||
'LOCATION': os.path.join(BASE_DIR, 'django_cache'),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Application definition
|
||||
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = BASE_DIR
|
||||
#STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
|
||||
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'),
|
||||
os.path.join(BASE_DIR, 'static/plots'),]
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, 'static'),
|
||||
os.path.join(BASE_DIR, 'static/plots'),
|
||||
]
|
||||
|
||||
|
||||
INTERNAL_IPS = ['127.0.0.1']
|
||||
@@ -99,10 +100,10 @@ SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
|
||||
|
||||
SITE_URL = "http://localhost:8000"
|
||||
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
# EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
|
||||
# EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
|
||||
EMAIL_BACKEND = 'django_ses.SESBackend'
|
||||
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
"""
|
||||
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/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from .settings import *
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
# 'HOST': 'localhost',
|
||||
},
|
||||
# 'TEST': {
|
||||
# 'CHARSET': 'utf8',
|
||||
# 'COLLATION': 'utf8_general_ci',
|
||||
# },
|
||||
|
||||
# 'slave': {
|
||||
# 'ENGINE': 'django.db.backends.mysql',
|
||||
# 'NAME': 'rowsanda_107501',
|
||||
# 'USER': 'rowsanda_107501',
|
||||
# 'PASSWORD': 'roeidata',
|
||||
# 'HOST': 'store3.rosti.cz',
|
||||
# 'PORT': '3306',
|
||||
# }
|
||||
}
|
||||
|
||||
#BROKER_URL = 'redis://localhost:6379/0'
|
||||
#CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
|
||||
#CELERY_IGNORE_RESULT = False
|
||||
|
||||
#CELERY_ACCEPT_CONTENT = ['json']
|
||||
#CELERY_TASK_SERIALIZER = 'json'
|
||||
#CELERY_RESULT_SERIALIZER = 'json'
|
||||
#CELERY_TRACK_STARTED = True
|
||||
#CELERY_SEND_TASK_SENT_EVENT = True
|
||||
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
INSTALLED_APPS += ['debug_toolbar',]
|
||||
|
||||
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware',]
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
|
||||
'LOCATION': os.path.join(BASE_DIR, 'django_cache'),
|
||||
}
|
||||
}
|
||||
|
||||
# Application definition
|
||||
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = BASE_DIR
|
||||
STATICFILES_DIRS = [os.path.join(BASE_DIR,'static/plots'),os.path.join(BASE_DIR,'static'),]
|
||||
|
||||
# INTERNAL_IPS = ['127.0.0.1']
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
LOGIN_REDIRECT_URL = '/rowers/list-workouts/'
|
||||
|
||||
SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies"
|
||||
|
||||
SITE_URL = "http://localhost:8000"
|
||||
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
|
||||
#EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
|
||||
#EMAIL_BACKEND = 'django_ses.SESBackend'
|
||||
|
||||
AWS_SES_REGION_NAME = 'eu-west-1'
|
||||
AWS_SES_REGION_ENDPOINT = 'email.eu-west-1.amazonaws.com'
|
||||
|
||||
EMAIL_HOST = CFG['aws_smtp']
|
||||
EMAIL_PORT = CFG['aws_port']
|
||||
EMAIL_HOST_USER = CFG['aws_smtp_username']
|
||||
EMAIL_HOST_PASSWORD = CFG['aws_smtp_password']
|
||||
EMAIL_USE_TLS = CFG['email_use_tls']
|
||||
DEFAULT_FROM_EMAIL = 'info@rowsandall.com'
|
||||
|
||||
SETTINGS_NAME = 'rowsandall_app.settings_thinkpad'
|
||||
|
||||
|
||||
@@ -25,69 +25,80 @@ from rowers import views as rowersviews
|
||||
from survey import views as surveyviews
|
||||
|
||||
import django
|
||||
import django.views.i18n
|
||||
|
||||
|
||||
# admin look
|
||||
admin.site.enable_nav_sidebar = False
|
||||
|
||||
import django.views.i18n
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
re_path('^', include('django.contrib.auth.urls')),
|
||||
re_path(r'^password_change_done/$',auth_views.PasswordChangeDoneView.as_view(),name='password_change_done'),
|
||||
re_path(r'^password_change/$',auth_views.PasswordChangeView.as_view(),name='password_change'),
|
||||
re_path(r'^password_reset/$',
|
||||
re_path(
|
||||
r'^password_change_done/$',
|
||||
auth_views.PasswordChangeDoneView.as_view(),
|
||||
name='password_change_done'),
|
||||
re_path(
|
||||
r'^password_change/$',
|
||||
auth_views.PasswordChangeView.as_view(),
|
||||
name='password_change'),
|
||||
re_path(
|
||||
r'^password_reset/$',
|
||||
auth_views.PasswordResetView.as_view(),
|
||||
{'template_name': 'rowers/templates/registration/password_reset.html'},
|
||||
name='password_reset'),
|
||||
re_path(r'^password_reset/done/$',
|
||||
re_path(
|
||||
r'^password_reset/done/$',
|
||||
auth_views.PasswordResetDoneView.as_view(),
|
||||
name='password_reset_done'),
|
||||
re_path(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
|
||||
re_path(
|
||||
r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
|
||||
auth_views.PasswordResetConfirmView.as_view(),
|
||||
name='password_reset_confirm'),
|
||||
re_path(r'^reset/done/$',
|
||||
re_path(
|
||||
r'^reset/done/$',
|
||||
auth_views.PasswordResetCompleteView.as_view(),
|
||||
name='password_reset_complete'),
|
||||
]
|
||||
]
|
||||
|
||||
urlpatterns += [
|
||||
re_path(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt',
|
||||
content_type='text/plain')),
|
||||
re_path(r'^robots\.txt$', TemplateView.as_view(
|
||||
template_name='robots.txt',
|
||||
content_type='text/plain')),
|
||||
re_path(r'^admin/', admin.site.urls),
|
||||
re_path(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework2')),
|
||||
re_path(r'^$',landingview),
|
||||
re_path(r'^landing/$',landingview),
|
||||
re_path(r'^getblogs/$',rowersviews.get_blog_posts),
|
||||
re_path(r'^$', landingview),
|
||||
re_path(r'^landing/$', landingview),
|
||||
re_path(r'^getblogs/$', rowersviews.get_blog_posts),
|
||||
re_path(r'^login/',
|
||||
# auth_views.LoginView,
|
||||
# auth_views.LoginView,
|
||||
auth_views.LoginView.as_view(),
|
||||
name='login'),
|
||||
re_path(r'^logout/$',
|
||||
auth_views.LogoutView.as_view(),
|
||||
{'next_page': '/'},
|
||||
name='logout',),
|
||||
re_path(r'^rowers/',include('rowers.urls')),
|
||||
# re_path(r'^survey/',include('survey.urls')),
|
||||
# re_path(r'^cvkbrno/',include('cvkbrno.urls')),
|
||||
# re_path(r'^admin/rq/',include('django_rq_dashboard.urls')),
|
||||
re_path(r'^call\_back',rowersviews.rower_process_callback),
|
||||
re_path(r'^nk\_callback',rowersviews.rower_process_nkcallback),
|
||||
re_path(r'^stravacall\_back',rowersviews.rower_process_stravacallback),
|
||||
re_path(r'^garmin\_callback',rowersviews.rower_process_garmincallback),
|
||||
re_path(r'^sporttracks\_callback',rowersviews.rower_process_sporttrackscallback),
|
||||
re_path(r'^polarflowcallback',rowersviews.rower_process_polarcallback),
|
||||
re_path(r'^tp\_callback',rowersviews.rower_process_tpcallback),
|
||||
re_path(r'^rp3\_callback',rowersviews.rower_process_rp3callback),
|
||||
re_path(r'^twitter\_callback',rowersviews.rower_process_twittercallback),
|
||||
auth_views.LogoutView.as_view(),
|
||||
{'next_page': '/'},
|
||||
name='logout',),
|
||||
re_path(r'^rowers/', include('rowers.urls')),
|
||||
# re_path(r'^survey/',include('survey.urls')),
|
||||
# re_path(r'^cvkbrno/',include('cvkbrno.urls')),
|
||||
# re_path(r'^admin/rq/',include('django_rq_dashboard.urls')),
|
||||
re_path(r'^call\_back', rowersviews.rower_process_callback),
|
||||
re_path(r'^nk\_callback', rowersviews.rower_process_nkcallback),
|
||||
re_path(r'^stravacall\_back', rowersviews.rower_process_stravacallback),
|
||||
re_path(r'^garmin\_callback', rowersviews.rower_process_garmincallback),
|
||||
re_path(r'^sporttracks\_callback', rowersviews.rower_process_sporttrackscallback),
|
||||
re_path(r'^polarflowcallback', rowersviews.rower_process_polarcallback),
|
||||
re_path(r'^tp\_callback', rowersviews.rower_process_tpcallback),
|
||||
re_path(r'^rp3\_callback', rowersviews.rower_process_rp3callback),
|
||||
re_path(r'^twitter\_callback', rowersviews.rower_process_twittercallback),
|
||||
re_path(r'^i18n/', include('django.conf.urls.i18n')),
|
||||
re_path(r'^tz_detect/', include('tz_detect.urls')),
|
||||
re_path(r'^logo/',logoview),
|
||||
re_path(r'^media/(?P<filename>.*\.fit)$',rowersviews.download_fit),
|
||||
re_path(r'^logo/', logoview),
|
||||
re_path(r'^media/(?P<filename>.*\.fit)$', rowersviews.download_fit),
|
||||
path('django-rq/', include('django_rq.urls')),
|
||||
# path('500/', rowersviews.error500_view),
|
||||
# re_path(r'^jsi18n/', django.views.i18n.javascript_catalog,name='jsi18n'),
|
||||
]
|
||||
# path('500/', rowersviews.error500_view),
|
||||
# re_path(r'^jsi18n/', django.views.i18n.javascript_catalog,name='jsi18n'),
|
||||
]
|
||||
|
||||
js_info_dict = {
|
||||
'packages': ('recurrence', ),
|
||||
@@ -100,7 +111,7 @@ urlpatterns += [
|
||||
# monkey patch workaround for bug in recurrence library
|
||||
django.views.i18n.javascript_catalog = None
|
||||
|
||||
if settings.DEBUG: # pragma: no cover
|
||||
if settings.DEBUG: # pragma: no cover
|
||||
import debug_toolbar
|
||||
import django
|
||||
urlpatterns += [
|
||||
@@ -109,10 +120,13 @@ if settings.DEBUG: # pragma: no cover
|
||||
kwargs={'document_root': settings.STATIC_ROOT+'plots/'})
|
||||
]
|
||||
urlpatterns += [
|
||||
# re_path(r'^__debug__/','debug_toolbar.urls'),
|
||||
re_path(r'^static/(?P<path>.*)$',
|
||||
# re_path(r'^__debug__/','debug_toolbar.urls'),
|
||||
re_path(
|
||||
r'^static/(?P<path>.*)$',
|
||||
django.views.static.serve,
|
||||
kwargs={'document_root': settings.STATIC_ROOT,
|
||||
'show_indexes': True}
|
||||
kwargs={
|
||||
'document_root': settings.STATIC_ROOT,
|
||||
'show_indexes': True
|
||||
}
|
||||
)
|
||||
]
|
||||
|
||||
@@ -9,65 +9,64 @@ from rowingdata import main as rmain
|
||||
|
||||
import random
|
||||
|
||||
def landingview(request):
|
||||
loginform = LoginForm()
|
||||
|
||||
return render(request,
|
||||
'landingpage.html',
|
||||
def landingview(request):
|
||||
return render(
|
||||
request,
|
||||
'landingpage.html',
|
||||
)
|
||||
|
||||
def logoview(request): # pragma: no cover
|
||||
|
||||
def logoview(request): # pragma: no cover
|
||||
image_data = open(settings.STATIC_ROOT+"/img/apple-icon-144x144.png", "rb").read()
|
||||
return HttpResponse(image_data, content_type="image/png")
|
||||
|
||||
|
||||
def rootview(request): # pragma: no cover
|
||||
def rootview(request): # pragma: no cover
|
||||
magicsentence = rmain()
|
||||
loginform = LoginForm()
|
||||
|
||||
planoffering = {
|
||||
'name': 'PLAN',
|
||||
'image':'/static/img/Plan.png',
|
||||
'text':'We offer a fully integrated way for you or your coach to set up a training plan. Compare plan vs execution based on time, distance, heart rate or power.'
|
||||
}
|
||||
'image': '/static/img/Plan.png',
|
||||
'text': 'We offer a fully integrated way for you or your coach to set up a training plan. Compare plan vs execution based on time, distance, heart rate or power.'
|
||||
}
|
||||
|
||||
uploadoffering = {
|
||||
'name': 'SYNC',
|
||||
'image':'/static/img/upload.png',
|
||||
'text':'Easily upload data from the most popular devices and apps'
|
||||
}
|
||||
'image': '/static/img/upload.png',
|
||||
'text': 'Easily upload data from the most popular devices and apps'
|
||||
}
|
||||
|
||||
logoffering = {
|
||||
'name': 'LOG',
|
||||
'image':'/static/img/log.png',
|
||||
'text':'Maintain a consistent log for all your rowing (indoor and on the water)'
|
||||
}
|
||||
'image': '/static/img/log.png',
|
||||
'text': 'Maintain a consistent log for all your rowing (indoor and on the water)'
|
||||
}
|
||||
|
||||
analyzeoffering = {
|
||||
'name': 'ANALYZE',
|
||||
'image':'/static/img/analyze.png',
|
||||
'text':'Analyze your workouts with a consistent set of tools'
|
||||
}
|
||||
'image': '/static/img/analyze.png',
|
||||
'text': 'Analyze your workouts with a consistent set of tools'
|
||||
}
|
||||
|
||||
compareoffering = {
|
||||
'name': 'COMPARE',
|
||||
'image':'/static/img/compare.png',
|
||||
'text':'Compare your results between workouts and with other rowers in your team'
|
||||
}
|
||||
'image': '/static/img/compare.png',
|
||||
'text': 'Compare your results between workouts and with other rowers in your team'
|
||||
}
|
||||
|
||||
raceoffering = {
|
||||
'name': 'RACE',
|
||||
'image':'/static/img/Race 01.png',
|
||||
'text':'Virtual regattas are an informal way to add a competitive element to your training and can be used as a quick way to set up small regattas'
|
||||
}
|
||||
'image': '/static/img/Race 01.png',
|
||||
'text': 'Virtual regattas are an informal way to add a competitive element to your training and can be used as a quick way to set up small regattas'
|
||||
}
|
||||
|
||||
coachoffering = {
|
||||
'name': 'COACHING',
|
||||
'image':'/static/img/Remote coaching.png',
|
||||
'text':'Rowsandall.com is the ideal platform for remote rowing coaching. As a coach, you can easily manage your athletes, set up plans and monitor execution and technique'
|
||||
}
|
||||
|
||||
|
||||
'image': '/static/img/Remote coaching.png',
|
||||
'text': 'Rowsandall.com is the ideal platform for remote rowing coaching. As a coach, you can easily manage your athletes, set up plans and monitor execution and technique'
|
||||
}
|
||||
|
||||
allofferings = [
|
||||
planoffering,
|
||||
@@ -77,7 +76,7 @@ def rootview(request): # pragma: no cover
|
||||
raceoffering,
|
||||
compareoffering,
|
||||
coachoffering,
|
||||
]
|
||||
]
|
||||
|
||||
aux = list(allofferings)
|
||||
random.shuffle(aux)
|
||||
@@ -88,6 +87,6 @@ def rootview(request): # pragma: no cover
|
||||
'frontpage.html',
|
||||
{
|
||||
'versionstring': magicsentence,
|
||||
'form':loginform,
|
||||
'offerings':offerings,
|
||||
'form': loginform,
|
||||
'offerings': offerings,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user