/damned-lies

new template for damned-lies

Primary LanguagePython

This is a re-implementation of the Damned-Lies application in Django.
Damned-Lies has been originally written by Danilo Segan
(danilo@gnome.org). This implementation has been written by Claude
Paroz (claude@2xlibre.net) and Stéphane Raimbault
(stephane.raimbault@gmail.com).

The former XML files (modules, releases, people, translation teams)
have been replaced by a database.

The Data model is in the /docs directory.


Requirements
============

1 - Django 1.3.X

2 - Python 2.5 (minimal)
    PIL (python-imaging) for hackergotchi checks.
    Markdown (python-markdown) for Team presentation markup rendering.

3 - gettext, intltool, gnome-doc-utils (for stats generation)

4 - South >= 0.7 - http://south.aeracode.org/
    South is a Django extension that allows you to track changes in your models
    over time, and to update the database to reflect those changes.

    See http://south.aeracode.org/wiki/Download for installation instructions

5 - [Optional] Django Debug Toolbar
    git clone git://github.com/dcramer/django-debug-toolbar.git
    Define USE_DEBUG_TOOLBAR to True in local_settings.py to use it.

6 - [Optional] python-openid and django-openid-auth (see OpenID support
    below).

7 - [Optional] python-pyicu for correct sorting in various languages

8 - [Optional] translate-toolkit >= 1.9.0-beta2 (--keeptranslations option for
    pogrep) for reduced po files.

Installation
============

1 - Create a local_settings.py and overwrite settings to match your requirements
    and your configuration layouts. Typical settings to customize include:
    DATABASES, DEBUG, TEMPLATE_DEBUG, STATIC_SERVE, ADMINS, MANAGERS, ADMIN_GROUP,
    SCRATCHDIR and various EMAIL settings.
    (please refer to Database configuration below for more
    informations).
    SCRATCHDIR should point to an existing directory, writable by
    the web application user.
    Note also that if you don't want to really send mail when testing the app, you
    can set the EMAIL_BACKEND setting as follows to redirect mail to the console:
    EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

2 - Run './manage.py syncdb' then:
    ./manage.py migrate

2b- If you want to populate the database with sample data, run:
    ./manage.py loaddata sample_data

3 - You should now be able to launch the server to check if all is running well:
    ./manage.py runserver

4 - Configure Sites in admin interface ('View on site' link, site address in sent
    mail).

Maintenance tasks
=================

There is a management command to run maintenance tasks (clean never-activated
accounts, inactivate unused roles, ...):
./manage.py run-maintenance
It might be useful to add the command in a cron schedule.

OpenID support
==============

If you want OpenID support, install django-openid-auth package:

http://pypi.python.org/pypi/django-openid-auth/

Set USE_DJANGO_OPENID to True in your local_settings.py.

This package is dependant on the python-openid package to be installed
on your system. Run 'python manage.py syncdb' and here we go!

Note: if you are using MySQL, you should modify a table column in models.py
of django-openid-auth:
Change:
  claimed_id = models.TextField(max_length=2047, unique=True)
To:
  claimed_id = models.CharField(max_length=255, unique=True)
See bug http://code.djangoproject.com/ticket/2495

Databases
=========

It's important to use the Unix Domain Socket connection to obtain good
performances.

PostgreSQL
----------

In the DATABASES['default'] dictionary, you just need to define
ENGINE = 'django.db.backends.postgresql_psycopg2' and the NAME key.
Leave HOST setting empty to use UDS.

MySQL
-----

Create a database in UTF8, either with default-character-set = utf8
under [mysqld] section in the my.cnf file or with an explicit 'create
database bla charset=utf8;'

In local_settings.py:

DATABASES = {
    'default' {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': '<your database name>',
        'USER': '<your user>',
        'PASSWORD': '<your password>',
        'HOST' = '/var/run/mysqld/mysqld.sock',
        'OPTIONS' = {
            'read_default_file': '/etc/mysql/my.cnf',
            'init_command': 'SET storage_engine=INNODB'
        }
    }
}

Grep for ANSI_QUOTES in the source code to find the models.py which
use a hack to workaround the double quotes interpretation in MySQL.
The best solution is to run the MySQL server with the ANSI_QUOTES
mode: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html
(sql-mode="ANSI_QUOTES" in my.cnf) but it can be dangerous for other
applications.


Running as CGI
==============

If you don't want to setup Django with Apache/mod_python, there is a tutorial
on the Django Wiki:

http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/
You'll also find a sample init script in the /docs directory.

You can also use Cherokee/SCGI:
http://www.cherokee-project.com/doc/cookbook_django.html


Translations
============

To be able to also extract strings from various database fields, a
wrapper script has been created around standard Django
make_messages. The script also copy po files in /po directory.

Run 'python manage.py update-trans' to update translations when there
are string changes.

After translation files in po directory have been updated, there is
another script to put back po files in
locale/<ll>/LC_MESSAGES/django.po and call Django's compile_messages
command.

Run 'python manage.py compile-trans'.