--- /dev/null
+.PHONY: deploy
+
+
+deploy: turniej/localsettings.py
+ pip install -r requirements.txt
+ ./manage.py migrate --noinput
+ ./manage.py collectstatic --noinput
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from django.views.generic import TemplateView
+from . import views
-urlpatterns = patterns('',
- url(r'^$', 'edition1.views.home', name='e1_main_page'),
+
+urlpatterns = [
+ url(r'^$', views.home, name='e1_main_page'),
url(r'^regulamin/$', TemplateView.as_view(template_name='edition1/rules.html'),
name='e1_rules_page'),
url(r'^wiecej/$', TemplateView.as_view(template_name='edition1/more.html'),
name='e1_more_page'),
url(r'^technikalia/$', TemplateView.as_view(template_name='edition1/technical.html'),
name='e1_technical_page'),
-)
+]
-from django.conf.urls import patterns, url
+from django.conf.urls import url
from django.views.generic import TemplateView
-urlpatterns = patterns('',
+urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='edition2/home.html'),
name='e2_main_page'),
url(r'^regulamin/$', TemplateView.as_view(template_name='edition2/rules.html'),
name='e2_more_page'),
url(r'^technikalia/$', TemplateView.as_view(template_name='edition2/technical.html'),
name='e2_technical_page'),
-)
+]
migrations.AddField(
model_name='poem',
name='poet',
- field=models.ForeignKey(to='poetry.Poet'),
+ field=models.ForeignKey(to='poetry.Poet', on_delete=models.CASCADE),
preserve_default=True,
),
]
-# -*- coding: utf-8 -*-
import os
import subprocess
from django.db import models
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.conf import settings
from poetry.utils import get_hash
slug = models.SlugField(max_length=50, db_index=True)
title = models.CharField(max_length=255, null=True, blank=True)
text = models.TextField()
- poet = models.ForeignKey(Poet)
+ poet = models.ForeignKey(Poet, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True, editable=False, db_index=True)
seen_at = models.DateTimeField(auto_now_add=True, editable=False)
view_count = models.IntegerField(default=1)
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from . import views
-urlpatterns = patterns('poetry.views',
- url(r'^wiersz/(?P<slug>[a-zA-Z0-9-]+)/$', 'poem', name='poetry_poem'),
- url(r"^$", "main", name="poetry_main"),
- url(r"^nowy/$", 'new', name="poetry_new"),
- url(r"^konkurs/$", 'contest', name="poetry_contest"),
- url(r"^(?P<slug>[a-zA-Z0-9-]+)/$", "poet", name="poetry_poet"),
- url(r"^(?P<slug>[a-zA-Z0-9-]+)/nowy/$", 'new', name="poetry_new"),
+urlpatterns = [
+ url(r'^wiersz/(?P<slug>[a-zA-Z0-9-]+)/$', views.poem, name='poetry_poem'),
-)
+ url(r"^$", views.main, name="poetry_main"),
+ url(r"^nowy/$", views.new, name="poetry_new"),
+ url(r"^konkurs/$", views.contest, name="poetry_contest"),
+ url(r"^(?P<slug>[a-zA-Z0-9-]+)/$", views.poet, name="poetry_poet"),
+ url(r"^(?P<slug>[a-zA-Z0-9-]+)/nowy/$", views.new, name="poetry_new"),
+]
def get_hash(seed):
sha_digest = sha1(('%d%s' % (time.time(), str(seed))
).encode('utf-8', 'replace')).digest()
- return urlsafe_b64encode(sha_digest).replace(b'=', b'').replace(b'_', b'-').lower()
+ return urlsafe_b64encode(sha_digest).decode('latin1').replace('=', '').replace('_', '-').lower()
+++ /dev/null
-from fnpdjango.deploy import *
-
-env.project_name = 'turniej'
-env.hosts = ['giewont.icm.edu.pl']
-env.user = 'lektury'
-env.app_path = '/srv/turniej.wolnelektury.pl'
-env.services = [
- DebianGunicorn('turniej'),
-]
+++ /dev/null
-django-debug-toolbar
--i https://py.mdrn.pl:8443/simple
+-i https://py.mdrn.pl/simple
-Django>=1.7,<1.8
-fnpdjango>=0.2,<0.3
+Django>=2.2,<2.3
+fnpdjango==0.4
django-piwik
-# -*- coding: utf-8 -*-
# Django settings for turniej project.
import os.path
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = False
-TEMPLATE_DEBUG = DEBUG
ADMINS = [
# ('Your Name', 'your_email@domain.com'),
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = [
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
-# 'django.template.loaders.eggs.Loader',
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'APP_DIRS': True,
+ 'DIRS': [
+ os.path.join(PROJECT_DIR, 'templates'),
+ ],
+ 'OPTIONS': {
+ 'context_processors': [
+ "django.template.context_processors.debug",
+ "django.template.context_processors.i18n",
+ "django.template.context_processors.media",
+ "django.template.context_processors.static",
+ "django.contrib.messages.context_processors.messages",
+ "django.template.context_processors.request",
+ ],
+ },
+ },
]
-MIDDLEWARE_CLASSES = [
+MIDDLEWARE = [
'django.middleware.common.CommonMiddleware',
- #'django.contrib.sessions.middleware.SessionMiddleware',
- #'django.middleware.csrf.CsrfViewMiddleware',
- #'django.contrib.auth.middleware.AuthenticationMiddleware',
- #'django.contrib.messages.middleware.MessageMiddleware',
]
ROOT_URLCONF = 'turniej.urls'
-TEMPLATE_DIRS = [
- # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
- # Always use forward slashes, even on Windows.
- # Don't forget to use absolute paths, not relative paths.
- os.path.join(PROJECT_DIR, 'templates'),
-]
-
-TEMPLATE_CONTEXT_PROCESSORS = (
- #"django.contrib.auth.context_processors.auth",
- "django.core.context_processors.debug",
- "django.core.context_processors.i18n",
- "django.core.context_processors.media",
- "django.core.context_processors.static",
- "django.contrib.messages.context_processors.messages",
- "django.core.context_processors.request",
-)
-TEMPLATE_CONTEXT_PROCESSORS += (
-)
-
INSTALLED_APPS = [
- #'django.contrib.auth',
- #'django.contrib.contenttypes',
- #'django.contrib.sessions',
'django.contrib.sites',
- #'django.contrib.messages',
'django.contrib.staticfiles',
- # 'django.contrib.admin',
- # 'django.contrib.admindocs',
-
'piwik',
'fnpdjango',
'edition2',
]
-# A sample logging configuration. The only tangible logging
-# performed by this configuration is to send an email to
-# the site admins on every HTTP 500 error.
-# See http://docs.djangoproject.com/en/dev/topics/logging for
-# more details on how to customize your logging configuration.
-LOGGING = {
- 'version': 1,
- 'disable_existing_loggers': False,
- 'handlers': {
- 'mail_admins': {
- 'level': 'ERROR',
- 'class': 'django.utils.log.AdminEmailHandler'
- }
- },
- 'loggers': {
- 'django.request': {
- 'handlers': ['mail_admins'],
- 'level': 'ERROR',
- 'propagate': True,
- },
- }
-}
-
POETRY_POEMS_FOR_CONTEST = 20
ALLOWED_HOSTS = [
-from django.conf.urls import patterns, include, url
-from edition2.urls import urlpatterns as e2_urlpatterns
+from django.conf.urls import include, url
-# from django.contrib import admin
-# admin.autodiscover()
-urlpatterns = patterns('',
+urlpatterns = [
url(r'^2011/', include('edition1.urls')),
url(r'^poezja/', include('poetry.urls')),
-) + e2_urlpatterns
+ url(r'', include('edition2.urls')),
+]