nuages.rst 4.78 KB
Newer Older
1 2 3 4 5 6 7
======
Nuages
======
-----------------
Easy poll sharing
-----------------

Christophe Siraut's avatar
Christophe Siraut committed
8
Nuages aims to provide a collaborative meeting poll system, similar to doodle or rdvz. It is build in python, using the django framework and a little of javascript. This application was named after Django's famous song. Feedback and collaboration are welcome at nuages @lists.domainepublic.net
9

Christophe Siraut's avatar
Christophe Siraut committed
10
The project uses the following django applications:
11

Christophe Siraut's avatar
Christophe Siraut committed
12 13 14
    - django-registration
    - django-datetime-widget
    - django-bootstrap-staticfiles
15

Christophe Siraut's avatar
Christophe Siraut committed
16 17 18
Automated installation
======================
Using setuptools all dependencies will be installed:
19

Christophe Siraut's avatar
Christophe Siraut committed
20
  # python setup.py install
21

Christophe Siraut's avatar
Christophe Siraut committed
22
This can also be achieved in a virtualenv:
chris's avatar
chris committed
23

Christophe Siraut's avatar
Christophe Siraut committed
24 25 26 27 28 29 30 31
  # virtualenv --system-site-packages env
  # source env/bin/activate
  # python setup.py install

Manual installation
===================
Install required dependencies and copy nuages to /usr/local/lib.

32
On debian and derivatives one can install it as follow:
Christophe Siraut's avatar
Christophe Siraut committed
33 34

  # aptitude install python-django python-django-registration
Joan's avatar
Joan committed
35
  # pip install django-datetime-widget django-bootstrap-staticfiles django-jquery
Christophe Siraut's avatar
Christophe Siraut committed
36 37 38 39

Local settings
==============
Use local_settings.py and local_urls.py to customize your installation when needed.
40

chris's avatar
chris committed
41 42
Translation
===========
43
Create/update a translation file::
44

45
    # django-admin makemessages -l fr
46

47
Edit and translate the translation file::
48

Christophe Siraut's avatar
Cleanup  
Christophe Siraut committed
49
    # vi locale/fr/LC_MESSAGES/django.po
50

51
Compile translated messages/update a translation file::
52

Christophe Siraut's avatar
Cleanup  
Christophe Siraut committed
53
    # make translation
54

55 56
Dev installation
================
57
Install python-django package (>=1.3)
58
Clone nuages archive somewhere in your home folder::
59 60 61 62

    # cd
    # git clone http://git.domainepublic.net/git/nuages.git

63
You can have local customizations in the nuages/local_settings.py file (and avoid modify the original settings.py)::
64

65
    # vi nuages/local_settings.py
66

67
Build nuages database::
68

69
    # ./manage.py syncdb
70

71
Start the python webserver::
72

73
    # ./manage.py runserver
74

75
You should have the application running at http://127.0.0.1:8000
76

chris's avatar
chris committed
77 78
Apache installation
===================
79
Install python-django package (>=1.3)
80
Copy nuages to /usr/local/lib/nuages::
81 82 83 84

    # cd /usr/local/lib
    # git clone http://git.domainepublic.net/git/nuages.git 

85
You can have local customizations in the local_settings.py file. (Optionally set DEBUG option to False)::
86

87
    # vi /usr/local/lib/nuages/nuages/local_settings.py
88

89
There are several ways to configure Apache and python, we recommend wsgi, simply install libapache2-mod-wsgi, and add the following to /etc/apache2/sites-available/nuages, replacing ServerName accordingly::
90

91
    <VirtualHost *:80>
92
      
93 94
      ServerName localhost.locadomain
      Alias /static/ /usr/local/lib/nuages/staticroot/
95
      WSGIScriptAlias / /usr/local/lib/nuages/nuages/wsgi.py
96

97 98 99 100 101
      <Directory /usr/local/lib/nuages/nuages>
        <Files wsgi.py>
        Order deny,allow
        Allow from all
        </Files>
102
      </Directory>
103

104 105 106 107
      <Directory /usr/local/lib/nuages/staticroot>
        Order deny,allow
        Allow from all
      </Directory>
108

109
    </VirtualHost>
110

111
Build database, collect static files and set permissions::
112

113
  # make update 
114

115
Set domain name: Point your browser to /admin/sites/site/1/ and modify the entry from "example.com" to your domain name.
Christophe Siraut's avatar
Christophe Siraut committed
116

117 118
SSL
===
119
We recommend using SSL for all transactions and adding the following settings to your local_settings.py::
120

121 122 123
  SESSION_COOKIE_SECURE = True
  CSRF_COOKIE_SECURE = True
  ALLOWED_HOSTS = [
124 125
        '.domainepublic.net', # Allow domain and subdomains
        '.domainepublic.net.', # Also allow FQDN and subdomains
126
  ]
127

Christophe Siraut's avatar
Christophe Siraut committed
128 129
Testing
=======
130
In order to test Nuages, you need the following dependencies::
Christophe Siraut's avatar
Christophe Siraut committed
131 132 133 134 135 136

  webtest
  coverage
  django_webtest
  django-discover-runner

137
On debian::
Christophe Siraut's avatar
Christophe Siraut committed
138

Joan's avatar
Joan committed
139
  # aptitude install python-webtest python-coverage python-pip
Christophe Siraut's avatar
Christophe Siraut committed
140 141
  # pip install django_webtest django-discover-runner

142
You can now validate your modifications with::
Christophe Siraut's avatar
Christophe Siraut committed
143 144 145

  # make test

146 147 148 149
Email Service
=============
Django is expecting a working SMTP server listening at localhost, sendmail for instance.

150
Another option is to add attributes in local_settings.py, so django can connect to an external server for the mail delivery. To enable this, we only have to add these lines::
151 152 153 154 155 156 157 158

  # Email attributes
  EMAIL_HOST = 'mail.example.com'
  EMAIL_PORT = '25'
  EMAIL_HOST_USER = 'username@example.com'
  EMAIL_HOST_PASSWORD = 'password'
  EMAIL_USE_TLS = False

Christophe Siraut's avatar
Cleanup  
Christophe Siraut committed
159 160
Update
======
161
In order to update your nuages installation::
Christophe Siraut's avatar
Cleanup  
Christophe Siraut committed
162 163 164 165 166

  # make update

Migration
=========
167
When models change, we need to perform some manual steps to keep existing data. The following example backups all databases to json files, and resets only the poll table::
168

169 170 171
  # mkdir fixtures
  # APPS="account auth meetingpoll poll"
  # for APP in $APPS; do ./manage.py dumpdata $APP --indent=2 > fixtures/$APP.json; done
172
  # git pull
173
  # ./manage.py flush poll
174
  # ./manage.py loaddata fixtures/*.json
Christophe Siraut's avatar
Cleanup  
Christophe Siraut committed
175