Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2022-03-15 10:01:47 +01:00
parent ded96b4ccd
commit 94967e4ada
9 changed files with 190 additions and 292 deletions

View File

@@ -1 +0,0 @@

View File

@@ -1,5 +1 @@
from django import forms from django import forms

View File

@@ -1,3 +1,2 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.db import models from django.db import models

View File

@@ -20,8 +20,6 @@ CFG = yamjam()['rowsandallapp']
DEFAULT_CHARSET = 'UTF-8' DEFAULT_CHARSET = 'UTF-8'
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -144,7 +142,6 @@ TEMPLATES = [
# 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.app_directories.Loader',
# ], # ],
}, },
}, },
] ]
@@ -254,9 +251,6 @@ MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# user authentication
# user authentication # user authentication
LOGIN_REDIRECT_URL = '/rowers/list-workouts/' LOGIN_REDIRECT_URL = '/rowers/list-workouts/'
LOGIN_URL = '/login/' LOGIN_URL = '/login/'

View File

@@ -21,8 +21,6 @@ for element in sys.argv:
if 'test' in element: if 'test' in element:
TESTING = True TESTING = True
if TESTING or use_sqlite: if TESTING or use_sqlite:
DATABASES = { DATABASES = {
'default': { 'default': {
@@ -31,7 +29,8 @@ if TESTING or use_sqlite:
'HOST': 'localhost', 'HOST': 'localhost',
'USER': '', 'USER': '',
'PASSWORD': 'roeidata', 'PASSWORD': 'roeidata',
'PORT': '3306', }, 'PORT': '3306',
},
# 'TEST': { # 'TEST': {
# 'CHARSET': 'utf8', # 'CHARSET': 'utf8',
# 'COLLATION': 'utf8_general_ci', # 'COLLATION': 'utf8_general_ci',
@@ -84,8 +83,10 @@ STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR 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'), STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static/plots'),] os.path.join(BASE_DIR, 'static'),
os.path.join(BASE_DIR, 'static/plots'),
]
INTERNAL_IPS = ['127.0.0.1'] INTERNAL_IPS = ['127.0.0.1']

View File

@@ -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'

View File

@@ -25,34 +25,45 @@ from rowers import views as rowersviews
from survey import views as surveyviews from survey import views as surveyviews
import django import django
import django.views.i18n
# admin look # admin look
admin.site.enable_nav_sidebar = False admin.site.enable_nav_sidebar = False
import django.views.i18n
urlpatterns = [ urlpatterns = [
re_path('^', include('django.contrib.auth.urls')), re_path('^', include('django.contrib.auth.urls')),
re_path(r'^password_change_done/$',auth_views.PasswordChangeDoneView.as_view(),name='password_change_done'), re_path(
re_path(r'^password_change/$',auth_views.PasswordChangeView.as_view(),name='password_change'), r'^password_change_done/$',
re_path(r'^password_reset/$', 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(), auth_views.PasswordResetView.as_view(),
{'template_name': 'rowers/templates/registration/password_reset.html'}, {'template_name': 'rowers/templates/registration/password_reset.html'},
name='password_reset'), name='password_reset'),
re_path(r'^password_reset/done/$', re_path(
r'^password_reset/done/$',
auth_views.PasswordResetDoneView.as_view(), auth_views.PasswordResetDoneView.as_view(),
name='password_reset_done'), 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(), auth_views.PasswordResetConfirmView.as_view(),
name='password_reset_confirm'), name='password_reset_confirm'),
re_path(r'^reset/done/$', re_path(
r'^reset/done/$',
auth_views.PasswordResetCompleteView.as_view(), auth_views.PasswordResetCompleteView.as_view(),
name='password_reset_complete'), name='password_reset_complete'),
] ]
urlpatterns += [ urlpatterns += [
re_path(r'^robots\.txt$', TemplateView.as_view(template_name='robots.txt', re_path(r'^robots\.txt$', TemplateView.as_view(
template_name='robots.txt',
content_type='text/plain')), content_type='text/plain')),
re_path(r'^admin/', admin.site.urls), re_path(r'^admin/', admin.site.urls),
re_path(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework2')), re_path(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework2')),
@@ -110,9 +121,12 @@ if settings.DEBUG: # pragma: no cover
] ]
urlpatterns += [ urlpatterns += [
# re_path(r'^__debug__/','debug_toolbar.urls'), # re_path(r'^__debug__/','debug_toolbar.urls'),
re_path(r'^static/(?P<path>.*)$', re_path(
r'^static/(?P<path>.*)$',
django.views.static.serve, django.views.static.serve,
kwargs={'document_root': settings.STATIC_ROOT, kwargs={
'show_indexes': True} 'document_root': settings.STATIC_ROOT,
'show_indexes': True
}
) )
] ]

View File

@@ -9,13 +9,14 @@ from rowingdata import main as rmain
import random import random
def landingview(request):
loginform = LoginForm()
return render(request, def landingview(request):
return render(
request,
'landingpage.html', '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() image_data = open(settings.STATIC_ROOT+"/img/apple-icon-144x144.png", "rb").read()
return HttpResponse(image_data, content_type="image/png") return HttpResponse(image_data, content_type="image/png")
@@ -67,8 +68,6 @@ def rootview(request): # pragma: no cover
'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' '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 = [ allofferings = [
planoffering, planoffering,
uploadoffering, uploadoffering,