Merge lp:~rachidbm/ubuntu-translations-stats/bug-971432 into lp:ubuntu-translations-stats

Proposed by Rachid
Status: Rejected
Rejected by: David Planella
Proposed branch: lp:~rachidbm/ubuntu-translations-stats/bug-971432
Merge into: lp:ubuntu-translations-stats
Diff against target: 131 lines (+103/-2)
3 files modified
INSTALL (+101/-0)
settings.py (+1/-1)
templates/stats/language_list.html (+1/-1)
To merge this branch: bzr merge lp:~rachidbm/ubuntu-translations-stats/bug-971432
Reviewer Review Type Date Requested Status
David Planella Needs Fixing
Review via email: mp+100889@code.launchpad.net

Description of the change

 - Added INSTALL containing the deployment instructions
 - Changed settings.py to make it compatible to Django 1.2.5
 - Fixed bug 971432 https://bugs.launchpad.net/ubuntu-translations-stats/+bug/971432

Hi David,

Thanks for the deployment instructions. I missed one line; The first time you need to create the DB tables with manage.py syncdb. I created a file with the instructions to set up this app.

Furthermore I fixed the bug I found. Maybe not the most elegant solution, but I saw "stats/" hardcoded on more places in the code.

Cheers,
Rachid.

FYI: I run this app on Ubuntu 11.04 (Django 1.2.5)

To post a comment you must log in.
Revision history for this message
David Planella (dpm) wrote :

Thanks a lot for your work and sorry for the long delay in coming back to you. My new focus on App Development means that I can only spend some spare time on translations development. I had to find some additional time to fix some infrastructure issues before activating stats for Quantal and to be able to come back to developing this webapp this cycle.

I have merged most of your changes, with some additional modifications (renamed the INSTALL file to README.md). However, regarding the proposed fix:

> {c:[{v:'<a href="/stats/{{release.name}}/{{language.code}}">{{language.name}}</a>'},

I'd rather fix it by a proper combination of Apache config and APPEND_SLASH rather than hardcoding the URL. Alternatively, if you can convince me that that's the only way, I'll be happy to merge the change :)

review: Needs Fixing
Revision history for this message
David Planella (dpm) wrote :

I've fixed the bug by using the Django url template tag as:

{c:[{v:'<a href="{% url language_details release.name,language.code %}">{{language.name}}</a>'}

As such, this issue is resolved and I'll mark this merge proposal as Rejected. Thanks for the other fixes and for putting me on the right track for this one!

Unmerged revisions

44. By Rachid

Fixed bug 971432 (Incorrect links in translations stats website)
https://bugs.launchpad.net/ubuntu-translations-stats/+bug/971432

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'INSTALL'
2--- INSTALL 1970-01-01 00:00:00 +0000
3+++ INSTALL 2012-04-04 22:14:40 +0000
4@@ -0,0 +1,101 @@
5+A web tool to report Ubuntu Translations statistics
6+https://launchpad.net/ubuntu-translations-stats
7+
8+
9+CAVEATS:
10+- The translation stats site runs on an Ubuntu 10.04 server
11+- It should also run on a 12.04 server, but I haven't widely tested it
12+- The big difference between 10.04 and 12.04 regarding this project is
13+the Django versions: the latest stable Django version uses a
14+configuration file syntax (settings.py) that is not backwards compatible.
15+
16+Package installation
17+--------------------
18+
19+sudo apt-get install python-django apache2 postgresql python-psycopg2 libapache2-mod-wsgi bzr mailutils
20+
21+Webapp installation
22+-------------------
23+
24+bzr branch lp:ubuntu-translations-stats ul10nstats
25+
26+Create a local_settings.py file in the same directory as the settings.py
27+file.
28+
29+NOTES:
30+- The DATABASE_PASSWORD should match the password you set up in the
31+'Postgresql setup' step below
32+- This is the syntax for an Ubuntu 10.04 server. I *think* in this case
33+it might work for both 12.04 and 10.04, but if it doesn't, you'll have
34+to use the syntax for the newer Django version (have a look at the
35+existing settings.py file)
36+
37+$ cat ul10nstats/local_settings.py
38+
39+DATABASE_ENGINE = 'postgresql_psycopg2'
40+DATABASE_NAME = 'ul10nstats'
41+DATABASE_USER = 'postgres'
42+DATABASE_PASSWORD = 'supersecretpassword'
43+DATABASE_HOST = 'localhost'
44+DATABASE_PORT = ''
45+
46+
47+Postgresql setup
48+----------------
49+
50+sudo -u postgres psql postgres
51+\password postgres
52+(here you set up your password and exit)
53+sudo -u postgres createdb ul10nstats
54+
55+Apache setup
56+------------
57+
58+Disable the default site config
59+Create /etc/apache2/sites-available/ul10nstats
60+(Change the paths to the path on your machine)
61+So change /home/ubuntu/ul10nstats
62+to /path/on/your/machine
63+
64+
65+Enable this site
66+
67+<VirtualHost *:80>
68+
69+ WSGIScriptAlias / /home/ubuntu/ul10nstats/wsgi.py
70+
71+ #Alias /admin/ /home/ubuntu/ul10nstats/media/
72+
73+ AliasMatch /admin/css/([^/]*\.css) /home/ubuntu/ul10nstats/admin-media/css/$1
74+ AliasMatch /admin/img/([^/]*) /home/ubuntu/ul10nstats/admin-media/img/$1
75+ AliasMatch /admin/js/([^/]*\.js) /home/ubuntu/ul10nstats/admin-media/js/$1
76+ AliasMatch /(ui-lightness/)([^/]*\.css) /home/ubuntu/ul10nstats/stats/static/css/$1/$2
77+ AliasMatch /([^/]*\.css) /home/ubuntu/ul10nstats/stats/static/css/$1
78+ AliasMatch /([^/]*\.js) /home/ubuntu/ul10nstats/stats/static/js/$1
79+ AliasMatch /([^/]*\.png) /home/ubuntu/ul10nstats/stats/static/img/$1
80+ AliasMatch /([^/]*\.ico) /home/ubuntu/ul10nstats/stats/static/img/$1
81+
82+ ErrorLog /var/log/apache2/error.log
83+
84+ # Possible values include: debug, info, notice, warn, error, crit,
85+ # alert, emerg.
86+ LogLevel warn
87+
88+ CustomLog /var/log/apache2/access.log combined
89+
90+</VirtualHost>
91+
92+Data setup
93+----------
94+
95+To set up the DB (CREATE TABLES etc), run:
96+$ python manage.py syncdb
97+
98+Once all that is set up, you'll need some sample data to test the site.
99+
100+From the ul10nstats directory just run:
101+$ python manage.py importdata
102+
103+I believe that's all you need. If you've got any questions or notice any
104+issues, just let me know.
105+
106
107=== modified file 'settings.py'
108--- settings.py 2012-03-02 07:10:51 +0000
109+++ settings.py 2012-04-04 22:14:40 +0000
110@@ -18,7 +18,7 @@
111 MANAGERS = ADMINS
112
113 major, minor, micro, releaselevel, serial = VERSION
114-DJANGO_1_1 = major == 1 and minor == 1
115+DJANGO_1_1 = major == 1 and (minor == 1 or minor == 2) # Django 1.2.x is compatible with 1.1
116 DJANGO_1_3 = major == 1 and minor == 3
117
118 EXTRA_MODULES = {
119
120=== modified file 'templates/stats/language_list.html'
121--- templates/stats/language_list.html 2012-03-02 07:10:51 +0000
122+++ templates/stats/language_list.html 2012-04-04 22:14:40 +0000
123@@ -10,7 +10,7 @@
124 cols:[{id:'language',label:'Language',type:'string'},
125 {id:'translated',label:'Translated',type:'number'}],
126 rows:[{% for language, percentage in language_list %}
127- {c:[{v:'<a href="{{release.name}}/{{language.code}}">{{language.name}}</a>'},
128+ {c:[{v:'<a href="/stats/{{release.name}}/{{language.code}}">{{language.name}}</a>'},
129 {v:{{percentage}},f:'{{percentage}} %'}]},
130 {% endfor %}]
131 };

Subscribers

People subscribed via source and target branches

to all changes: