README
changeset 1 eb9188f2ee4f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README	Fri Oct 22 18:14:30 2010 +0200
@@ -0,0 +1,119 @@
+==============================
+Dring 93 - Ubuntu 10.04
+==============================
+
+1 - Database creation
+2 - Virtualenv installation
+3 - Settings
+4 - Database synchronization
+5 - .htaccess files
+6 - WSGI script file
+
+
+1 - Database creation
+======================
+Create a database in Postgres:
+  createdb -U username -W -h 127.0.0.1 d
+
+Access to te database in Postgres:
+  psql -U username -W -h 127.0.0.1 dbname
+
+\d to view the list of all relations
+
+
+2 - Virtualenv installation
+============================
+Run the bootstrap script generator:
+  python create_python_env.py 
+
+Run project-boot.py this way:
+  python hg/dring93/sbin/virtualenv/project-boot.py --no-site-packages --setuptools --unzip-setuptools --type-install=local --ignore-packages=MYSQL path/to/env/Env
+
+To activate the environment:
+  source path/to/env/Env/bin/activate
+
+
+
+3 - Settings
+=============
+Enter the db settings in dring93/web/dring93/config.py:
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.postgresql_psycopg2',
+        'NAME': 'dbDring',
+        'USER': 'iriuser', 
+        'PASSWORD': 'iriuser',
+        'HOST': 'localhost',
+        'PORT': '5432',
+    }
+}
+
+Change the URL paths:
+BASE_URL = '/dev/~user/dring93/'
+WEB_URL = 'http://www.iri.centrepompidou.fr/'
+
+
+In your public_html, create a symbolic link that points to the application:
+  ln -s path/to/project/dring93 dring93
+
+
+4 - Database synchronization
+=============================
+Synchronize the database, in dring93/web/dring93:
+  python manage.py syncdb
+
+
+5 - .htaccess files
+====================
+Write dring93/web/.htaccess:
+
+# Permanent redirection to dring93/franculture
+RedirectMatch permanent /~user/dring93/?$ /~user/dring93/dring93
+
+
+Write dring93/web/dring93/.htaccess:
+
+# Set environmental variables used in the wsgi file
+SetEnv DJANGO_SETTINGS_MODULE dring93.settings
+SetEnv PY_USE_XMLPLUS true
+SetEnv PROJECT_PATH /path/to/project/dring93/web
+SetEnv PYTHON_PATH /path/to/virtual/environment/Env/lib/python2.6/site-packages
+
+Options ExecCGI FollowSymLinks
+SetHandler wsgi-script
+
+RewriteEngine On
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^(.*)$ /path/to/wsgiscript/modwsgi.wsgi/$1 [QSA,PT,L]
+
+# html cache options
+Header set Pragma "no-cache"
+Header set Cache-Control "no-cache"
+Header set Expires "-1"
+
+
+
+6 - WSGI script file
+======================
+
+Write the WSGI file modwsgi.wsgi
+
+import os, sys, site
+
+def application(environ, start_response):
+        os.environ['DJANGO_SETTINGS_MODULE'] = environ['DJANGO_SETTINGS_MODULE']
+        os.environ['PY_USE_XMLPLUS'] = environ['PY_USE_XMLPLUS']
+
+        sys.path.append(environ['PROJECT_PATH'])
+        site.addsitedir(environ['PYTHON_PATH'])
+
+        import django.core.handlers.wsgi
+        _application = django.core.handlers.wsgi.WSGIHandler()
+
+        return _application(environ, start_response)
+
+
+Notes:
+- The 'environ' argument is unrelated to the 'os.environ' argument. It catches the variables that were defined with 'SetEnv' in the .htaccess file.
+- 'sys.path.append' adds the project path to the PYTHONPATH
+- 'site.addsitedir' activates the virtual environment