-
Notifications
You must be signed in to change notification settings - Fork 4
/
README
140 lines (98 loc) · 4.58 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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.