152 lines
4.7 KiB
ReStructuredText
152 lines
4.7 KiB
ReStructuredText
Document box for the Wallon Parliement
|
|
======================================
|
|
|
|
This software is a web application allowing group of people to send files to
|
|
each other and to list of them. It distributes and timestamps the sent
|
|
documents. The timestamp is a cryptographic timestamp obtained using the
|
|
RFC3161 protocol.
|
|
|
|
The application is pre-configured to run with a postgresql database named
|
|
docbow. The user running the application need access to this database. On most
|
|
Unix system it means creating a postgresql user with the same name as the Unix
|
|
user it the database server runs on the same host.
|
|
|
|
Installation
|
|
------------
|
|
|
|
- Create a virtualenv::
|
|
|
|
virtualenv --no-site-packages env/
|
|
|
|
- Activate it::
|
|
|
|
. ./env/bin/activate
|
|
|
|
- Install dependencies (some dependencies require to compile C code, like
|
|
python-ldap, for them you will some developement package installed, on
|
|
Debian, it means gcc, python-dev, libssl-dev, libldap-dev, libsasl2-dev,
|
|
libpq-dev)::
|
|
|
|
pip install -r requirements.txt
|
|
|
|
- Create user and database (you can replace $USER by www-data for a WSGI
|
|
installation)::
|
|
|
|
sudo -u postgres createuser $USER
|
|
sudo -u postgres createdb -O $USER docbow
|
|
|
|
- Create database schema and load initial data::
|
|
|
|
( cd docbow_project; python manage.py syncdb --migrate )
|
|
( cd docbow_project; python manage.py loaddata content filetype groups )
|
|
|
|
- Compile UI strings translations::
|
|
|
|
( cd docbow_project; python manage.py compilemessages )
|
|
|
|
- Load user list (you need to get a user list as a CSV files, see format later)::
|
|
|
|
( cd docbow_project; python manage.py load-users-csv users.csv )
|
|
|
|
Upgrading
|
|
---------
|
|
|
|
When you upgrade you must execute this from the root directory:
|
|
|
|
( cd docbow_project; python manage.py syncdb --migrate )
|
|
|
|
if you application run as another user (www-data for example if using WSGI)::
|
|
|
|
( cd docbow_project; sudo -u www-data python manage.py syncdb --migrate )
|
|
|
|
Installation on Debian with Apache2/mod_wsgi
|
|
--------------------------------------------
|
|
|
|
First install some development libraries::
|
|
|
|
sudo apt-get install gcc libldap-dev libsasl2-dev python-dev libssl-dev libpq-dev swig gettext
|
|
|
|
Now you can follow the generic installation described before.
|
|
|
|
Collect all static content::
|
|
|
|
(cd docbow_project; python manage.py collectstatic)
|
|
|
|
After that you must install apache2 and the mod_wsgi module. On Debian do::
|
|
|
|
sudo apt-get install apache2 libapache2-mod-wsgi
|
|
|
|
You must configure the apache2 script to launch with an UTF-8 locale. On debian
|
|
you can add the following line to /etc/default/apache2 (supposing you have the
|
|
french locale with UTF-8 encoding compiled)::
|
|
|
|
ENV="$ENV LANG=fr_FR.UTF-8 LC_ALL=fr_FR.UTF-8"
|
|
|
|
Then you must add a virtual host configuration which target the docbow wsgi
|
|
script. On debian you can put the following content in
|
|
/etc/apache2/sites-enabled/docbow.example.com, do not forget to replace
|
|
<docbow_src_dir> by the source directory where docbow is installed::
|
|
|
|
<VirtualHost *:80>
|
|
ServerName docbow.example.com
|
|
|
|
Alias /static <docbow_src_dir>/static
|
|
WSGIScriptAlias / <docbow_src_dir>/docbow.wsgi
|
|
RedirectMatch 404 ^/favicon.ico$
|
|
|
|
</VirtualHost>
|
|
|
|
Then you must activate it with the commands::
|
|
|
|
a2ensite docbow.example.com
|
|
/etc/init.d/apache2 reload
|
|
|
|
Installation on Debian using gunicorn and apache2
|
|
-------------------------------------------------
|
|
|
|
First install some development libraries::
|
|
|
|
apt-get install gcc libldap-dev libsasl2-dev python-dev libssl-dev libpq-dev swig gettext
|
|
|
|
Now you can follow the generic installation described before.
|
|
|
|
Install gunicorn::
|
|
|
|
./env/bin/pip install gunicorn
|
|
|
|
Collect all static content::
|
|
|
|
(cd docbow_project; python manage.py collectstatic)
|
|
|
|
After that you must install apache2 and the mod_wsgi module. On Debian do::
|
|
|
|
sudo apt-get install apache2
|
|
|
|
Then you must add a virtual host configuration which target the gunicorn
|
|
application server. On debian you can put the following content in
|
|
/etc/apache2/sites-enabled/docbow.example.com, do not forget to replace
|
|
<docbow_src_dir> by the source directory where docbow is installed::
|
|
|
|
<VirtualHost *:80>
|
|
ServerName docbow.example.com
|
|
|
|
DocumentRoot /var/www
|
|
ProxyPass /static !
|
|
ProxyPass / http://localhost:8000/
|
|
ProxyPreserveHost on
|
|
Alias /static <docbow_src_dir>/static
|
|
<Proxy *>
|
|
Order Deny,Allow
|
|
Allow from all
|
|
</Proxy>
|
|
</VirtualHost>
|
|
|
|
Now run the gunicorn server (it must run as an user which has access to the
|
|
docbow postgresql database)::
|
|
|
|
LANG=C.UTF-8 PYTHONPATH=. gunicorn_django -D ./docbow_project/
|
|
|
|
You must set a charset to use as file are created with name recevied from user
|
|
agents which can contain any unicode character. The locale "C.UTF-8" works in
|
|
this case.
|