Skip to content
This repository has been archived by the owner on May 12, 2019. It is now read-only.

scoiatael/zapisy_zosia

Repository files navigation

LEGAL STUFF

"THE BEER/PIZZA-WARE LICENSE" (Revision 42):
<dreamer.tan@gmail.com> wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer (or pizza) in return. Patryk Obara

--------------------------------------------------------------------------------

A little bit of code was copied and slightly modified from Django itself;
all of it is in templates so any file in */template/ dir is under BSD.

The YAML framework is published under the Creative Commons Attribution 2.0 License.

Smiley images in static_media/images are part of GNOME project, thus under GPLv2.

logo_zosi.svg was created by Adrian Dziubek

sorttable.js was written Stuart Langridge, published under X11 license.

-------------------------------------------------------------------------------

Every command example below is assumed to be run with zapisy_zosia as current
directory unless explicitly stated otherwise.

PREREQUISITIES

you will of course need:
- django (>=1.0) [looks like 1.1 works just fine :) ]
- python (>=2.5, <3.0)
- textile (2.1.3 works fine; called python-textile in Fedora)

Textile is the least popular of bunch, so in case you don't find it in repository:

$ sudo easy_install textile

if bash will complain to you, that command is not found then:
1) blame your distribution
2) install package setuptools (some distros may name it python-setuptools)
   if not found again, go to step 1 or...
3) compile it yourself (http://pypi.python.org/pypi/textile)

DEVELOPMENT

to create database:
$ python manage.py syncdb

to run developer server (port 8000):
$ python manage.py runserver

TRANSLATION

update *.po files, and run
$ django-admin compilemessages


CHANGES REQUIRED BEFORE DEPLOYING ZAPISY FOR NEW ZOSIA

* Change the text of email messages - that is, the content of the txt files in
  the zapisy_zosia/templates directory.
* Update all dates - change dates in functions in common/helpers.py
* Update costs: function count_payment(user) in registration/views.py
* Update rest of templates: including place, dates, costs, bank account,
  sponsors, links, etc


FIRST DEPLOYMENT

1) Following will create zapisy_zosia directory and put all files inside:
   $ git clone http://github.com/dreamer_/zapisy_zosia.git

   Cloning using git is recommended; if you don't want to use git, you can
   simply unpack tarball with files wherever you want (it will block you from
   upgrading in future, so, beware).

2) Update settings.py file with correct database name/pass, mailer address/pass
 
3) In settings.py change DEBUG variable to False

4) $ python manage.py syncdb

5) Update web server configuration so that it runs this Django project.

6) If you own a domain that you want to point to this application, configure the
   domain records and update Apache's configuration so that it recognizes the
   redirection.

7) Restart server!


UPDATING ALREADY DEPLOYED VERSION

0) If zosia was not touched since last year, you may want to clean db a bit;
   easiest way to achieve it is to go to admin panel and remove all users.
   Just remember:
   - Don't remove yourself!
   - Create backup of blogposts and lectures from previous year - removing
     authors will remove their blog notes or lectures.
   - Remove old organizations from organization list - leave only those
     few that matters (KSI and II for example).
   - Remove all rooms, too.

1) Make sure there are no local changes in repository:
   $ git diff
   If there are no changes, then go to step (2), otherwise (perhaps settings.py
   file changed?) commit all changes:
   $ git commit -a -m "Local deployment changes"

2) Following incantation will get latest version from origin repo and reapply
   changes required by local deployment (such as settings.py file):
   $ git pull --rebase

3) In case incantation from step (2) failed, resolve carefully all conflicts.

4) If pulled changes were in:
   - templates only: they will be picked up automatically, you're ready to go
   - model: you have to manually ALTER tables in database
     tip: $ python manage.py sqlall <appname>
   - code/translations: you need server restart, contact administrator

5) Follow step (6) or (7) from FIRST DEPLOYMENT section, if they are required


Usually, this procedure could be shortened to:
$ git pull --rebase
# <server restart>
But follow steps 1-4 closely, to make sure you didn't miss anything.

Oh, one more thing:
REMEMBER, never push from deployment repository!


----------------------------------------------------------------------------

Q: How to change, how much does this Zosia cost (breakfasts/dinners/night) ?
A: Change values in your zosia definition (admin panel) if there is something different in payment rules,
   change model, registatration form and look @ function count_payment(user) in registration/views.py

Q: How can I change dates for my zosia deployment? It's not 2010 any more!
A: Change values in your zosia definition (admin panel) and change templates/index.html if needed

Q: Where is my CSS on admin pages?! I just deployed zosia and my admin page
   is unusable!!!
A: Ops! system expects them to be in /static_media/css/ directory, but for
   release deployment this may not work out of the box; try linking
   correct files in filesystem, e.g.:
   base.css -> /usr/share/python-support/python-django/django/contrib/admin/media/css/base.css