From 96480f028f5d5908774c469ee9cbf38768225464 Mon Sep 17 00:00:00 2001
From: Radek Czajka
Date: Wed, 23 Apr 2014 17:29:03 +0200
Subject: [PATCH 1/1] Simple update.
---
apps/edition1/templates/edition1/base.html | 5 +-
apps/edition1/templates/edition1/home.html | 1 -
.../templates/edition1/technical.html | 4 +-
apps/edition1/urls.py | 10 +-
apps/edition2/templates/edition2/base.html | 6 +-
apps/edition2/templates/edition2/home.html | 1 -
apps/edition2/templates/edition2/more.html | 2 +-
apps/edition2/templates/edition2/rules.html | 2 +-
.../templates/edition2/technical.html | 6 +-
apps/edition2/urls.py | 12 +-
apps/poetry/templates/poetry/contest.html | 1 -
apps/poetry/templates/poetry/main.html | 1 -
apps/poetry/templates/poetry/poem.html | 6 +-
apps/poetry/templates/poetry/poet.html | 1 -
apps/poetry/urls.py | 2 +-
apps/poetry/utils.py | 4 +-
fabfile.py | 205 +----------------
lib/git-archive-all.sh | 208 ------------------
manage.py | 15 ++
requirements.txt | 7 +-
turniej.vhost.template | 31 ---
turniej.wsgi.template | 26 ---
turniej/manage.py | 26 ---
turniej/settings.py | 7 +-
turniej/templates/base.html | 5 +-
turniej/urls.py | 3 +-
turniej/wsgi.py | 18 ++
27 files changed, 82 insertions(+), 533 deletions(-)
delete mode 100644 lib/git-archive-all.sh
create mode 100755 manage.py
delete mode 100644 turniej.vhost.template
delete mode 100644 turniej.wsgi.template
delete mode 100755 turniej/manage.py
create mode 100644 turniej/wsgi.py
diff --git a/apps/edition1/templates/edition1/base.html b/apps/edition1/templates/edition1/base.html
index 6f34f1c..b851855 100644
--- a/apps/edition1/templates/edition1/base.html
+++ b/apps/edition1/templates/edition1/base.html
@@ -1,4 +1,4 @@
-
+
Turniej ElektrybaÅtów{% block "extratitle" %}{% endblock %}
@@ -31,7 +31,8 @@
-{{ piwik_tag|safe }}
+{% load piwik_tags %}
+{% tracking_code %}
diff --git a/apps/edition1/templates/edition1/home.html b/apps/edition1/templates/edition1/home.html
index 5d6b031..b2159ae 100644
--- a/apps/edition1/templates/edition1/home.html
+++ b/apps/edition1/templates/edition1/home.html
@@ -1,5 +1,4 @@
{% extends "edition1/base.html" %}
-{% load url from future %}
{% block "body" %}
diff --git a/apps/edition1/templates/edition1/technical.html b/apps/edition1/templates/edition1/technical.html
index 557f081..ada8028 100644
--- a/apps/edition1/templates/edition1/technical.html
+++ b/apps/edition1/templates/edition1/technical.html
@@ -101,14 +101,14 @@ turnieju.
radoslaw.czajka@nowoczesnapolska.org.pl.
Prosimy też o doÅÄ
czenie do każdego zgÅoszenia klauzuli o treÅci:
ZgÅaszam siÄ do konkursu âTurniej ElektrybaÅtówâ i oÅwiadczam, że
-znam i akceptujÄ jego regulamin.
+znam i akceptujÄ jego regulamin.
-Powrót do strony gÅównej
+Powrót do strony gÅównej
{% endblock %}
diff --git a/apps/edition1/urls.py b/apps/edition1/urls.py
index 15f729f..285808f 100755
--- a/apps/edition1/urls.py
+++ b/apps/edition1/urls.py
@@ -1,12 +1,12 @@
-from django.conf.urls.defaults import patterns, include, url
-from django.views.generic.simple import direct_to_template
+from django.conf.urls import patterns, url
+from django.views.generic import TemplateView
urlpatterns = patterns('',
url(r'^$', 'edition1.views.home', name='e1_main_page'),
- url(r'^regulamin/$', direct_to_template, {'template': 'edition1/rules.html'},
+ url(r'^regulamin/$', TemplateView.as_view(template_name='edition1/rules.html'),
name='e1_rules_page'),
- url(r'^wiecej/$', direct_to_template, {'template': 'edition1/more.html'},
+ url(r'^wiecej/$', TemplateView.as_view(template_name='edition1/more.html'),
name='e1_more_page'),
- url(r'^technikalia/$', direct_to_template, {'template': 'edition1/technical.html'},
+ url(r'^technikalia/$', TemplateView.as_view(template_name='edition1/technical.html'),
name='e1_technical_page'),
)
diff --git a/apps/edition2/templates/edition2/base.html b/apps/edition2/templates/edition2/base.html
index b7e3392..fbb7a81 100644
--- a/apps/edition2/templates/edition2/base.html
+++ b/apps/edition2/templates/edition2/base.html
@@ -1,4 +1,4 @@
-
+
Turniej Wolnych Lektur{% block "extratitle" %}{% endblock %}
@@ -24,8 +24,8 @@
-
-{{ piwik_tag|safe }}
+{% load piwik_tags %}
+{% tracking_code %}
diff --git a/apps/edition2/templates/edition2/home.html b/apps/edition2/templates/edition2/home.html
index c7339a0..dcac65d 100644
--- a/apps/edition2/templates/edition2/home.html
+++ b/apps/edition2/templates/edition2/home.html
@@ -1,5 +1,4 @@
{% extends "edition2/base.html" %}
-{% load url from future %}
{% block "body" %}
diff --git a/apps/edition2/templates/edition2/more.html b/apps/edition2/templates/edition2/more.html
index e69e192..85a6689 100644
--- a/apps/edition2/templates/edition2/more.html
+++ b/apps/edition2/templates/edition2/more.html
@@ -3,7 +3,7 @@
{% block "body" %}
-
+
II Turniej Wolnych Lektur
diff --git a/apps/edition2/templates/edition2/rules.html b/apps/edition2/templates/edition2/rules.html
index 8ccbdd7..cb3a692 100644
--- a/apps/edition2/templates/edition2/rules.html
+++ b/apps/edition2/templates/edition2/rules.html
@@ -4,7 +4,7 @@
-
+
II Turniej Wolnych Lektur
diff --git a/apps/edition2/templates/edition2/technical.html b/apps/edition2/templates/edition2/technical.html
index b1d91c8..bb55b09 100644
--- a/apps/edition2/templates/edition2/technical.html
+++ b/apps/edition2/templates/edition2/technical.html
@@ -4,7 +4,7 @@
-
+
II Turniej Wolnych Lektur
@@ -47,14 +47,14 @@
turniej@nowoczesnapolska.org.pl.
Prosimy też o doÅÄ
czenie do każdego zgÅoszenia klauzuli o treÅci:
ZgÅaszam siÄ do konkursu âII Turniej Wolnych Lekturâ i oÅwiadczam, że
- znam i akceptujÄ jego regulamin.
+ znam i akceptujÄ jego regulamin.
-Powrót do strony gÅównej
+Powrót do strony gÅównej
{% endblock %}
diff --git a/apps/edition2/urls.py b/apps/edition2/urls.py
index a3ad7dc..93c4c8c 100755
--- a/apps/edition2/urls.py
+++ b/apps/edition2/urls.py
@@ -1,13 +1,13 @@
-from django.conf.urls.defaults import patterns, include, url
-from django.views.generic.simple import direct_to_template
+from django.conf.urls import patterns, url
+from django.views.generic import TemplateView
urlpatterns = patterns('',
- url(r'^$', direct_to_template, {'template': 'edition2/home.html'},
+ url(r'^$', TemplateView.as_view(template_name='edition2/home.html'),
name='e2_main_page'),
- url(r'^regulamin/$', direct_to_template, {'template': 'edition2/rules.html'},
+ url(r'^regulamin/$', TemplateView.as_view(template_name='edition2/rules.html'),
name='e2_rules_page'),
- url(r'^wiecej/$', direct_to_template, {'template': 'edition2/more.html'},
+ url(r'^wiecej/$', TemplateView.as_view(template_name='edition2/more.html'),
name='e2_more_page'),
- url(r'^technikalia/$', direct_to_template, {'template': 'edition2/technical.html'},
+ url(r'^technikalia/$', TemplateView.as_view(template_name='edition2/technical.html'),
name='e2_technical_page'),
)
diff --git a/apps/poetry/templates/poetry/contest.html b/apps/poetry/templates/poetry/contest.html
index 1e455a5..9852c75 100644
--- a/apps/poetry/templates/poetry/contest.html
+++ b/apps/poetry/templates/poetry/contest.html
@@ -1,5 +1,4 @@
{% extends "edition1/base.html" %}
-{% load url from future %}
{% block "body" %}
diff --git a/apps/poetry/templates/poetry/main.html b/apps/poetry/templates/poetry/main.html
index fe0e808..6234003 100644
--- a/apps/poetry/templates/poetry/main.html
+++ b/apps/poetry/templates/poetry/main.html
@@ -1,5 +1,4 @@
{% extends "edition1/base.html" %}
-{% load url from future %}
{% block "body" %}
diff --git a/apps/poetry/templates/poetry/poem.html b/apps/poetry/templates/poetry/poem.html
index 261a749..0ac6b3c 100644
--- a/apps/poetry/templates/poetry/poem.html
+++ b/apps/poetry/templates/poetry/poem.html
@@ -1,5 +1,4 @@
-{% load url from future %}
-
+
Turniej ElektrybaÅtów: {{ poem }}
@@ -78,7 +77,8 @@
-{{ piwik_tag|safe }}
+{% load piwik_tags %}
+{% tracking_code %}
diff --git a/apps/poetry/templates/poetry/poet.html b/apps/poetry/templates/poetry/poet.html
index f8ec96c..7947a66 100644
--- a/apps/poetry/templates/poetry/poet.html
+++ b/apps/poetry/templates/poetry/poet.html
@@ -1,5 +1,4 @@
{% extends "edition1/base.html" %}
-{% load url from future %}
{% block "extratitle" %}: {{ poet.name }}{% endblock %}
diff --git a/apps/poetry/urls.py b/apps/poetry/urls.py
index 40bef6d..50017a5 100644
--- a/apps/poetry/urls.py
+++ b/apps/poetry/urls.py
@@ -1,4 +1,4 @@
-from django.conf.urls.defaults import *
+from django.conf.urls import patterns, url
urlpatterns = patterns('poetry.views',
url(r'^wiersz/(?P[a-zA-Z0-9-]+)/$', 'poem', name='poetry_poem'),
diff --git a/apps/poetry/utils.py b/apps/poetry/utils.py
index 76dce25..29473da 100644
--- a/apps/poetry/utils.py
+++ b/apps/poetry/utils.py
@@ -1,10 +1,10 @@
import time
from base64 import urlsafe_b64encode
-from django.utils.hashcompat import sha_constructor
+from hashlib import sha1
def get_hash(seed):
- sha_digest = sha_constructor('%s%s' %
+ sha_digest = sha1('%s%s' %
(time.time(), unicode(seed).encode('utf-8', 'replace'))).digest()
return urlsafe_b64encode(sha_digest).replace('=', '').replace('_', '-').lower()
diff --git a/fabfile.py b/fabfile.py
index eb30a2f..049085c 100644
--- a/fabfile.py
+++ b/fabfile.py
@@ -1,200 +1,9 @@
-from __future__ import with_statement # needed for python 2.5
-from fabric.api import *
-from fabric.contrib import files
+from fnpdjango.deploy import *
-import os
-
-
-# ==========
-# = Config =
-# ==========
-# Globals
env.project_name = 'turniej'
-env.use_south = True
-
-# Servers
-def giewont():
- env.hosts = ['giewont.icm.edu.pl']
- env.user = 'lektury'
- env.path = '/srv/turniej.wolnelektury.pl'
- env.virtualenv = '/usr/bin/virtualenv'
- # This goes to VHost configuration
- env.server_name = 'turniej.wolnelektury.pl'
- env.server_admin = 'Radoslaw Czajka '
- # /var/log/apache2/* logs
- env.access_log = 'turniej.log'
- env.error_log = 'turniej-errors.log'
-
-
-servers = [giewont]
-
-# =========
-# = Tasks =
-# =========
-def test():
- "Run the test suite and bail out if it fails"
- require('hosts', 'path', provided_by=servers)
- require('python', provided_by=[find_python])
- result = run('cd %(path)s/%(project_name)s; %(python)s manage.py test' % env)
-
-def setup():
- """
- Setup a fresh virtualenv as well as a few useful directories, then run
- a full deployment. virtualenv with pip should be already installed.
- """
- require('hosts', 'path', 'virtualenv', provided_by=servers)
-
- run('mkdir -p %(path)s; cd %(path)s; %(virtualenv)s ve;' % env, pty=True)
- run('cd %(path)s; mkdir releases; mkdir packages;' % env, pty=True)
- run('cd %(path)s/releases; ln -s . current; ln -s . previous' % env, pty=True)
- upload_default_localsettings()
- deploy()
-
-def deploy():
- """
- Deploy the latest version of the site to the servers,
- install any required third party modules,
- install the virtual host and then restart the webserver
- """
-
- import time
- env.release = time.strftime('%Y-%m-%dT%H%M')
-
- upload_tar_from_git()
- find_python()
- upload_wsgi_script()
- upload_vhost_sample()
- install_requirements()
- copy_localsettings()
- symlink_current_release()
- collectstatic()
- migrate()
- restart_webserver()
-
-def deploy_version(version):
- "Specify a specific version to be made live"
- require('hosts', 'path', provided_by=servers)
- env.version = version
- with cd(env.path):
- run('rm releases/previous; mv releases/current releases/previous;', pty=True)
- run('ln -s %(version)s releases/current' % env, pty=True)
- restart_webserver()
-
-def rollback():
- """
- Limited rollback capability. Simple loads the previously current
- version of the code. Rolling back again will swap between the two.
- """
- require('hosts', 'path', provided_by=servers)
- with cd(env.path):
- run('mv releases/current releases/_previous;', pty=True)
- run('mv releases/previous releases/current;', pty=True)
- run('mv releases/_previous releases/previous;', pty=True)
- restart_webserver()
-
-
-# =====================================================================
-# = Helpers. These are called by other functions rather than directly =
-# =====================================================================
-def upload_tar_from_git():
- "Create an archive from the current Git branch and upload it"
- print '>>> upload tar from git'
- require('path', provided_by=servers)
- require('release', provided_by=[deploy])
- local('/bin/bash lib/git-archive-all.sh --format tar %(release)s.tar' % env)
- local('gzip %(release)s.tar' % env)
- run('mkdir -p %(path)s/releases/%(release)s' % env, pty=True)
- run('mkdir -p %(path)s/packages' % env, pty=True)
- put('%(release)s.tar.gz' % env, '%(path)s/packages/' % env)
- run('cd %(path)s/releases/%(release)s && tar zxf ../../packages/%(release)s.tar.gz' % env, pty=True)
- local('rm %(release)s.tar.gz' % env)
-
-def find_python():
- "Finds where virtualenv Python stuff is"
- print ">>> find Python paths"
- require('path', provided_by=servers)
- env.python = '%(path)s/ve/bin/python' % env
- env.pip = '%(path)s/ve/bin/pip' % env
- env.site_packages = run('%(python)s -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"' % env)
-
-def upload_vhost_sample():
- "Create and upload Apache virtual host configuration sample"
- print ">>> upload vhost sample"
- require('path', 'project_name', 'user', provided_by=servers)
- require('access_log', 'error_log', 'server_admin', 'server_name', provided_by=servers)
- require('site_packages', provided_by=[find_python])
- files.upload_template('%(project_name)s.vhost.template' % env, '%(path)s/%(project_name)s.vhost' % env, context=env)
-
-def upload_wsgi_script():
- "Create and upload a wsgi script sample"
- print ">>> upload wsgi script sample"
- require('path', 'project_name', provided_by=servers)
- require('python', 'site_packages', provided_by=[find_python])
- files.upload_template('%(project_name)s.wsgi.template' % env, '%(path)s/%(project_name)s.wsgi' % env, context=env)
- run('chmod ug+x %(path)s/%(project_name)s.wsgi' % env)
-
-def install_requirements():
- "Install the required packages from the requirements file using pip"
- print '>>> install requirements'
- require('path', provided_by=servers)
- require('release', provided_by=[deploy])
- require('pip', provided_by=[find_python])
- run('%(pip)s install -r %(path)s/releases/%(release)s/requirements.txt' % env, pty=True)
-
-def secret_key():
- """Generates a new SECRET_KEY."""
- from random import Random
- import string
-
- r = Random()
- return "".join(r.choice(string.printable) for i in range(64))
-
-def upload_default_localsettings():
- "Uploads localsettings.py with media paths and stuff"
- print ">>> upload default localsettings.py"
- require('path', provided_by=servers)
-
- env.secret_key = secret_key()
- files.upload_template('%(project_name)s/localsettings.py.template' % env, '%(path)s/localsettings.py' % env, context=env)
-
-def copy_localsettings():
- "Copy localsettings.py from root directory to release directory (if this file exists)"
- print ">>> copy localsettings"
- require('path', 'project_name', provided_by=servers)
- require('release', provided_by=[deploy])
-
- with settings(warn_only=True):
- run('cp %(path)s/localsettings.py %(path)s/releases/%(release)s/%(project_name)s' % env)
-
-def symlink_current_release():
- "Symlink our current release"
- print '>>> symlink current release'
- require('path', provided_by=servers)
- require('release', provided_by=[deploy])
- with cd(env.path):
- run('rm releases/previous; mv releases/current releases/previous')
- run('ln -s %(release)s releases/current' % env)
-
-def collectstatic():
- """Runs collectstatic management command from Django staticfiles."""
- print '>>> collectstatic'
- require('path', 'project_name', provided_by=servers)
- require('python', provided_by=[find_python])
- with cd('%(path)s/releases/current/%(project_name)s' % env):
- run('%(python)s manage.py collectstatic --noinput' % env, pty=True)
-
-def migrate():
- "Update the database"
- print '>>> migrate'
- require('path', 'project_name', provided_by=servers)
- require('python', provided_by=[find_python])
- with cd('%(path)s/releases/current/%(project_name)s' % env):
- run('%(python)s manage.py syncdb --noinput' % env, pty=True)
- if env.use_south:
- run('%(python)s manage.py migrate' % env, pty=True)
-
-def restart_webserver():
- "Restart the web server"
- print '>>> restart webserver'
- require('path', 'project_name', provided_by=servers)
- run('touch %(path)s/%(project_name)s.wsgi' % env)
+env.hosts = ['giewont.icm.edu.pl']
+env.user = 'lektury'
+env.app_path = '/srv/turniej.wolnelektury.pl'
+env.services = [
+ DebianGunicorn('turniej'),
+]
diff --git a/lib/git-archive-all.sh b/lib/git-archive-all.sh
deleted file mode 100644
index 95e8582..0000000
--- a/lib/git-archive-all.sh
+++ /dev/null
@@ -1,208 +0,0 @@
-#!/bin/bash -
-#
-# File: git-archive-all.sh
-#
-# Description: A utility script that builds an archive file(s) of all
-# git repositories and submodules in the current path.
-# Useful for creating a single tarfile of a git super-
-# project that contains other submodules.
-#
-# Examples: Use git-archive-all.sh to create archive distributions
-# from git repositories. To use, simply do:
-#
-# cd $GIT_DIR; git-archive-all.sh
-#
-# where $GIT_DIR is the root of your git superproject.
-#
-# License: GPL3
-#
-###############################################################################
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-###############################################################################
-
-# DEBUGGING
-set -e
-set -C # noclobber
-
-# TRAP SIGNALS
-trap 'cleanup' QUIT EXIT
-
-# For security reasons, explicitly set the internal field separator
-# to newline, space, tab
-OLD_IFS=$IFS
-IFS='
- '
-
-function cleanup () {
- rm -f $TMPFILE
- rm -f $TOARCHIVE
- IFS="$OLD_IFS"
-}
-
-function usage () {
- echo "Usage is as follows:"
- echo
- echo "$PROGRAM <--version>"
- echo " Prints the program version number on a line by itself and exits."
- echo
- echo "$PROGRAM <--usage|--help|-?>"
- echo " Prints this usage output and exits."
- echo
- echo "$PROGRAM [--format ] [--prefix ] [--separate|-s] [output_file]"
- echo " Creates an archive for the entire git superproject, and its submodules"
- echo " using the passed parameters, described below."
- echo
- echo " If '--format' is specified, the archive is created with the named"
- echo " git archiver backend. Obviously, this must be a backend that git archive"
- echo " understands. The format defaults to 'tar' if not specified."
- echo
- echo " If '--prefix' is specified, the archive's superproject and all submodules"
- echo " are created with the prefix named. The default is to not use one."
- echo
- echo " If '--separate' or '-s' is specified, individual archives will be created"
- echo " for each of the superproject itself and its submodules. The default is to"
- echo " concatenate individual archives into one larger archive."
- echo
- echo " If 'output_file' is specified, the resulting archive is created as the"
- echo " file named. This parameter is essentially a path that must be writeable."
- echo " When combined with '--separate' ('-s') this path must refer to a directory."
- echo " Without this parameter or when combined with '--separate' the resulting"
- echo " archive(s) are named with a dot-separated path of the archived directory and"
- echo " a file extension equal to their format (e.g., 'superdir.submodule1dir.tar')."
-}
-
-function version () {
- echo "$PROGRAM version $VERSION"
-}
-
-# Internal variables and initializations.
-readonly PROGRAM=`basename "$0"`
-readonly VERSION=0.2
-
-OLD_PWD="`pwd`"
-TMPDIR=${TMPDIR:-/tmp}
-TMPFILE=`mktemp "$TMPDIR/$PROGRAM.XXXXXX"` # Create a place to store our work's progress
-TOARCHIVE=`mktemp "$TMPDIR/$PROGRAM.toarchive.XXXXXX"`
-OUT_FILE=$OLD_PWD # assume "this directory" without a name change by default
-SEPARATE=0
-
-FORMAT=tar
-PREFIX=
-TREEISH=HEAD
-
-# RETURN VALUES/EXIT STATUS CODES
-readonly E_BAD_OPTION=254
-readonly E_UNKNOWN=255
-
-# Process command-line arguments.
-while test $# -gt 0; do
- case $1 in
- --format )
- shift
- FORMAT="$1"
- shift
- ;;
-
- --prefix )
- shift
- PREFIX="$1"
- shift
- ;;
-
- --separate | -s )
- shift
- SEPARATE=1
- ;;
-
- --version )
- version
- exit
- ;;
-
- -? | --usage | --help )
- usage
- exit
- ;;
-
- -* )
- echo "Unrecognized option: $1" >&2
- usage
- exit $E_BAD_OPTION
- ;;
-
- * )
- break
- ;;
- esac
-done
-
-if [ ! -z "$1" ]; then
- OUT_FILE="$1"
- shift
-fi
-
-# Validate parameters; error early, error often.
-if [ $SEPARATE -eq 1 -a ! -d $OUT_FILE ]; then
- echo "When creating multiple archives, your destination must be a directory."
- echo "If it's not, you risk being surprised when your files are overwritten."
- exit
-elif [ `git config -l | grep -q '^core\.bare=false'; echo $?` -ne 0 ]; then
- echo "$PROGRAM must be run from a git working copy (i.e., not a bare repository)."
- exit
-fi
-
-# Create the superproject's git archive
-git archive --format=$FORMAT --prefix="$PREFIX" $TREEISH > $TMPDIR/$(basename $(pwd)).$FORMAT
-echo $TMPDIR/$(basename $(pwd)).$FORMAT >| $TMPFILE # clobber on purpose
-superfile=`head -n 1 $TMPFILE`
-
-# find all '.git' dirs, these show us the remaining to-be-archived dirs
-find . -name '.git' -type d -print | sed -e 's/^\.\///' -e 's/\.git$//' | (grep -v '^$' || echo -n) >> $TOARCHIVE
-
-while read path; do
- TREEISH=$(git submodule | grep "^ .*${path%/} " | cut -d ' ' -f 2) # git submodule does not list trailing slashes in $path
- cd "$path"
- git archive --format=$FORMAT --prefix="${PREFIX}$path" ${TREEISH:-HEAD} > "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT
- if [ $FORMAT == 'zip' ]; then
- # delete the empty directory entry; zipped submodules won't unzip if we don't do this
- zip -d "$(tail -n 1 $TMPFILE)" "${PREFIX}${path%/}" >/dev/null # remove trailing '/'
- fi
- echo "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT >> $TMPFILE
- cd "$OLD_PWD"
-done < $TOARCHIVE
-
-# Concatenate archives into a super-archive.
-if [ $SEPARATE -eq 0 ]; then
- if [ $FORMAT == 'tar' ]; then
- sed -e '1d' $TMPFILE | while read file; do
- tar --concatenate -f "$superfile" "$file" && rm -f "$file"
- done
- elif [ $FORMAT == 'zip' ]; then
- sed -e '1d' $TMPFILE | while read file; do
- # zip incorrectly stores the full path, so cd and then grow
- cd `dirname "$file"`
- zip -g "$superfile" `basename "$file"` && rm -f "$file"
- done
- cd "$OLD_PWD"
- fi
-
- echo "$superfile" >| $TMPFILE # clobber on purpose
-fi
-
-while read file; do
- mv "$file" "$OUT_FILE"
-done < $TMPFILE
diff --git a/manage.py b/manage.py
new file mode 100755
index 0000000..0984221
--- /dev/null
+++ b/manage.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+import os
+import sys
+
+ROOT = os.path.dirname(os.path.abspath(__file__))
+sys.path = [
+ os.path.join(ROOT, 'apps'),
+] + sys.path
+
+if __name__ == "__main__":
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "turniej.settings")
+
+ from django.core.management import execute_from_command_line
+
+ execute_from_command_line(sys.argv)
diff --git a/requirements.txt b/requirements.txt
index 053fd5a..5743d4f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,8 +1,7 @@
-i http://pypi.nowoczesnapolska.org.pl/simple
-Django>=1.4,<1.5
+Django>=1.6,<1.7
South>=0.7.4
-django-pipeline>=1.2,<1.3
-fnpdjango<0.2
+fnpdjango>=0.1.18,<0.2
-piwik
+django-piwik
diff --git a/turniej.vhost.template b/turniej.vhost.template
deleted file mode 100644
index 68c3f48..0000000
--- a/turniej.vhost.template
+++ /dev/null
@@ -1,31 +0,0 @@
-
- ServerName "%(server_name)s"
- ServerAdmin "%(server_admin)s"
-
- WSGIDaemonProcess %(project_name)s user=%(user)s group=%(user)s processes=2 threads=15 display-name=%%{GROUP} python-path=%(site_packages)s
- WSGIProcessGroup %(project_name)s
-
- WSGIScriptAlias / %(path)s/%(project_name)s.wsgi
-
- Order allow,deny
- allow from all
-
-
- Alias /media %(path)s/media
-
- Options Indexes
- Order allow,deny
- Allow from all
-
-
- Alias /static %(path)s/static
-
- Options Indexes
- Order allow,deny
- Allow from all
-
-
- LogLevel warn
- ErrorLog /var/log/apache2/%(error_log)s
- CustomLog /var/log/apache2/%(access_log)s combined
-
diff --git a/turniej.wsgi.template b/turniej.wsgi.template
deleted file mode 100644
index af1781c..0000000
--- a/turniej.wsgi.template
+++ /dev/null
@@ -1,26 +0,0 @@
-#!%(python)s
-import site
-site.addsitedir('%(site_packages)s')
-
-import os
-from os.path import abspath, dirname, join
-import sys
-
-# Redirect sys.stdout to sys.stderr for bad libraries like geopy that use
-# print statements for optional import exceptions.
-sys.stdout = sys.stderr
-
-# Add apps and lib directories to PYTHONPATH
-sys.path = [
- '%(path)s/releases/current/%(project_name)s',
- '%(path)s/releases/current',
- '%(path)s/releases/current/apps',
- '%(path)s/releases/current/lib',
- # add paths to submodules here
-] + sys.path
-
-# Run Django
-os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
-
-from django.core.handlers.wsgi import WSGIHandler
-application = WSGIHandler()
diff --git a/turniej/manage.py b/turniej/manage.py
deleted file mode 100755
index eb91c2d..0000000
--- a/turniej/manage.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-import os.path
-import sys
-
-ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-
-# Add apps and lib directories to PYTHONPATH
-sys.path = [
- os.path.join(ROOT, 'apps'),
- os.path.join(ROOT, 'lib'),
- # add /lib/* paths here for submodules
-] + sys.path
-
-from django.core.management import execute_manager
-import imp
-try:
- imp.find_module('settings') # Assumed to be in the same directory.
-except ImportError:
- import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n" % __file__)
- sys.exit(1)
-
-import settings
-
-if __name__ == "__main__":
- execute_manager(settings)
diff --git a/turniej/settings.py b/turniej/settings.py
index a05bb68..b9525ed 100644
--- a/turniej/settings.py
+++ b/turniej/settings.py
@@ -101,7 +101,6 @@ MIDDLEWARE_CLASSES = [
#'django.middleware.csrf.CsrfViewMiddleware',
#'django.contrib.auth.middleware.AuthenticationMiddleware',
#'django.contrib.messages.middleware.MessageMiddleware',
- 'piwik.django.middleware.PiwikMiddleware',
]
ROOT_URLCONF = 'turniej.urls'
@@ -137,7 +136,7 @@ INSTALLED_APPS = [
# 'django.contrib.admindocs',
'south',
- 'piwik.django',
+ 'piwik',
'fnpdjango',
'poetry',
@@ -170,6 +169,10 @@ LOGGING = {
POETRY_POEMS_FOR_CONTEST = 20
+ALLOWED_HOSTS = [
+ 'turniej.wolnelektury.pl',
+]
+
# Load localsettings, if they exist
try:
from localsettings import *
diff --git a/turniej/templates/base.html b/turniej/templates/base.html
index 273547b..132e4f3 100644
--- a/turniej/templates/base.html
+++ b/turniej/templates/base.html
@@ -1,4 +1,4 @@
-
+
Turniej ElektrybaÅtów{% block "extratitle" %}{% endblock %}
@@ -30,7 +30,8 @@
-{{ piwik_tag|safe }}
+{% load piwik_tags %}
+{% tracking_code %}
diff --git a/turniej/urls.py b/turniej/urls.py
index 117df8b..56baf14 100644
--- a/turniej/urls.py
+++ b/turniej/urls.py
@@ -1,5 +1,4 @@
-from django.conf.urls.defaults import patterns, include, url
-from django.views.generic.simple import direct_to_template
+from django.conf.urls import patterns, include, url
from edition2.urls import urlpatterns as e2_urlpatterns
# from django.contrib import admin
diff --git a/turniej/wsgi.py b/turniej/wsgi.py
new file mode 100644
index 0000000..f97d8fd
--- /dev/null
+++ b/turniej/wsgi.py
@@ -0,0 +1,18 @@
+import os
+import os.path
+import sys
+
+ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+# Add apps and lib directories to PYTHONPATH
+sys.path = [
+ os.path.join(ROOT, 'apps'),
+] + sys.path
+
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "turniej.settings")
+
+# This application object is used by the development server
+# as well as any WSGI server configured to use this file.
+from django.core.wsgi import get_wsgi_application
+application = get_wsgi_application()
--
2.20.1