#37 Doc + facilite l'installation

Ouvert
seba veut fusionner 4 commits à partir de tetaneutral.net/36_docs_installation vers tetaneutral.net/master

+ 93 - 0
README.md

@@ -8,3 +8,96 @@ Système d’Information (SI) du FAI associatif tetaneutral.net
 * Wiki : https://chiliproject.tetaneutral.net/projects/tetaneutral/wiki/Djadhere/
 * Jabber : djadhere@chat.cannelle.eu.org ([webchat](https://jappix.cannelle.eu.org/?r=djadhere@chat.cannelle.eu.org))
 * IRC : `#djadhere` sur le réseau `irc.freenode.net` ([webchat](https://kiwiirc.com/client/chat.freenode.net?chan=#djadhere))
+
+# Instalattion
+
+Testé sous Ubuntu 18.04 et et Debian Stretch, en utilisant la base de données de spatialite (sqlite + extension géographique)
+
+
+Installer les sources:
+```
+sudo apt install git
+git clone https://code.ffdn.org/tetaneutral.net/djadhere/
+cd djadhere
+```
+
+Installer les pré-requis:
+```
+sudo apt install spatialite-bin libsqlite3-mod-spatialite gdal-bin
+```
+
+
+Installer un environnement virtuel
+```
+sudo apt install virtualenv python3-virtualenv python3-pip
+# on crée l'environnement
+virtualenv --python=python3 venv
+# on l'active
+. venv/bin/activate
+```
+
+Installer les dépendances pythoniques
+```
+pip install -r requirements.txt
+# en attendant la merge request
+pip install psycopg2-binary
+```
+
+Pour Ubuntu 18.04, il faut donner le chemin complet de l'extension spatialite, dans le fichier djadhere/settings.py, remplacer
+```
+SPATIALITE_LIBRARY_PATH = 'mod_spatialite'
+```
+par
+```
+SPATIALITE_LIBRARY_PATH = '/usr/lib/x86_64-linux-gnu/mod_spatialite.so'
+```
+
+Pour sqlite, il faut desactiver les transactions quand on renomme une colonne de la bd:
+```
+--- a/adhesions/migrations/0007_auto_20170301_1429.py
++++ b/adhesions/migrations/0007_auto_20170301_1429.py
+@@ -6,6 +6,7 @@ from django.db import migrations
+ 
+ 
+ class Migration(migrations.Migration):
++    atomic = False
+
+```
+
+```
+--- a/services/migrations/0022_auto_20170514_2302.py
++++ b/services/migrations/0022_auto_20170514_2302.py
+@@ -7,6 +7,7 @@ import django.db.models.deletion
+ 
+ 
+ class Migration(migrations.Migration):
++    atomic = False
+ 
+     dependencies = [
+         ('services', '0021_auto_20170514_2243'),
+
+```
+
+Il faut rajouter 2 variables dans djadhere/settings.py:
+```
+ALLOCATIONS_EMAILS = []
+PAYMENTS_EMAILS = []
+```
+*Djanos : A intégrer dans le code ?*
+
+Il faut ensuite créer la base de données:
+```
+./manage.py migrate
+```
+
+Pensez aussi à créer un compte d'administration:
+```
+./manage.py createsuperuser mon_utilisateur
+```
+
+On peut alors lancer la version la version de dev:
+```
+./manage.py runserver
+```
+
+Le site sera accéssible via http://127.0.0.1:8000/

+ 1 - 0
adhesions/migrations/0007_auto_20170301_1429.py

@@ -6,6 +6,7 @@ from django.db import migrations
 
 
 class Migration(migrations.Migration):
+    atomic = False
 
     dependencies = [
         ('adhesions', '0006_adherent_created'),

+ 3 - 0
djadhere/settings.py

@@ -180,3 +180,6 @@ LEAFLET_CONFIG = {
 }
 
 CHECK_MK_URL = 'https://nagios.tetaneutral.net/ttnn/check_mk/index.py?start_url=%2Fttnn%2Fcheck_mk%2Fview.py%3Fhost%3D{host}%26site%3Dttnn%26view_name%3Dhoststatus'
+
+ALLOCATIONS_EMAILS = []
+PAYMENTS_EMAILS = []

+ 1 - 0
requirements.txt

@@ -4,3 +4,4 @@ django-leaflet
 django-geojson
 django-mptt
 ipaddress
+psycopg2-binary

+ 1 - 0
services/migrations/0022_auto_20170514_2302.py

@@ -7,6 +7,7 @@ import django.db.models.deletion
 
 
 class Migration(migrations.Migration):
+    atomic = False
 
     dependencies = [
         ('services', '0021_auto_20170514_2243'),