Skip to content

fpirola/DDTSS-Django

 
 

Repository files navigation

DDTSS-Django
============

This is the experimental Django reimplementation of the DDTSS. The old
system used a simple key-value store without transactions and couldn't
access the DDTP database directly. This version is implemented in Django
with SQLalchemy for the ORM.

First is a basic setup guide, below is some more details for developers.

Setup
=====

To setup this version to run locally you need to do a few steps.

1. Configure virtualenv and buildout.
$ virtualenv python
$ python/bin/pip install -U setuptools
$ python/bin/python bootstrap.py
$ bin/buildout

This will download an install any packages needed to run the DDTSS. You will
need to install a postgresql server manually.

2. Create a PostgreSQL database called 'ddtp' with the correct encoding.

$ createdb ddtp -E UTF8

You probably need to the database superuser to do this.

Make sure you can connect to it without a password, preferably with 'ident
sameuser' authentication.  The user name is not relevant, you should be able
to login with your normal user name (otherwise see createuser).  Ensure that
when you type:

$ psql ddtp

It logs you into the database without asking for a password.

3. Setup the schema for DDTP.

$ psql ddtp -q -f src/ddtp/database/initial/install-ddtp.sql

This should complete without any errors.

If you want to test the DDTSS, you need more. Note that the schema for the
DDTSS is not yet finalised and subject to change, so you may have to redo
this step occasionally.

$ psql ddtp -q -f src/ddtp/database/initial/install-ddtss.sql

4. Add some sample data. Without some data in the database you can't do very
much.

Download the sample data. This is just a tiny fraction (approximately one
10,000th) of the full DDTP database, but enough to get you started with
testing everything.  It can be loaded in seconds rather than hours.

$ wget http://kleptog.org/temp/ddtp-sample.tar.gz -O /tmp/ddtp-sample.tar.gz

Unpack the tarball:
$ tar -xzf /tmp/ddtp-sample.tar.gz -C .

Then while in that directory execute:
$ psql ddtp -q -f src/ddtp/database/initial/load_sample.sql

This should also complete without errors or warnings. You should just see
the sequence values being updated.

For sample data for the DDTSS, you need to do:
$ psql ddtp -q -f src/ddtp/database/initial/load_sample_ddtss.sql

Note the sample data does not include any users. You will have to create
those yourself.
Remove file used to import data:
$ rm active_tb.txt description_tag_tb.txt description_tb.txt languages_tb.txt package_version_tb.txt part_description_tb.txt part_tb.txt pendingtranslations_tb.txt pendingtranslationreview_tb.txt translation_tb.txt 

5. Create log directory:
You can choose a different path/destination by changing /src/ddtp/settings.py file.
We suggest to save in a directory in order to group all ddtss log files.
$ su -
# mkdir /var/log/ddtss/
# chown [your_user]:[your_user] /var/log/ddtss/
Close root session:
# exit

6. Start up the Django test server.
Setting up a full production Django server is outside the scope of this
README. This runs the development server:
$ bin/django syncdb
$ bin/django runserver

There is now a test server running on http://localhost:8000/

This should let you browse more of the functionality, but if you want to see
everything you will need to make yourself superuser. To do that create an
account using the interface (don't worry about the email check, that's not
implemented yet).

After you've done that, log in to the database to make yourself superuser.

$ psql ddtp
psql (9.3.4)
ddtp=# update users_tb set superuser=true;
UPDATE 1

Once you have done this you will be able to access the admin screen. From
there you can make yourself language coordinator and so see the coordinator
screens.

Development Tips
================

This is a Buildout with a Django project. All sources are in the src/
directory.  The project is in src/ddtp/.  Within that we have the following
directories:

src/ddtp           - Project root
    development.py - Development Django settings
    production.py  - Production Django settings
    urls.py        - Main URL configuration

src/ddtp/database  - Database setup and configuration
    db.py          - database session setup
    ddtp.py        - ORM for DDTP tables
    ddtss.py       - ORM for DDTSS tables

src/ddtp/ddt       - DDTP website application
    views.py       - Views for DDTP application

src/ddtp/templates - Templates for DDTP website
    ddtss/         - Templates for DDTSS website

src/ddtp/static    - Static content used by templates

For development it is useful to know the command:

$ bin/django shell

Which gives you an IPython shell with all the paths set correctly.

About

Django implementation of DDTSS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 73.3%
  • Python 20.7%
  • CSS 6.0%