Taille: 1590
Commentaire:
|
Taille: 1791
Commentaire: complément
|
Texte supprimé. | Texte ajouté. |
Ligne 9: | Ligne 9: |
* http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango |
|
Ligne 31: | Ligne 33: |
import sys | import sys |
Ligne 33: | Ligne 35: |
sys.path.append('/srv/www/python-mtl/') sys.path.append('/srv/www/python-mtl/testwsgi/') |
sys.path.append('/srv/www/python-mtl/') sys.path.append('/srv/www/python-mtl/testwsgi/') |
Ligne 36: | Ligne 38: |
os.environ['DJANGO_SETTINGS_MODULE'] = 'testwsgi.settings' | os.environ['DJANGO_SETTINGS_MODULE'] = 'testwsgi.settings' |
Ligne 38: | Ligne 40: |
import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() |
import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler() |
Ligne 41: | Ligne 43: |
* installer les modules python utilisés par l'application. Mais il faut d'abord savoir quoi installer :-( |
Comment déployer en mod WSGI une application développée avec Django
- en gros :
- Configurer Apache en activant mod_wsgi
- créer un script Python pour configurer notre appli pour qu'elle utilise mod_wsgi
Un peu de recherche sur le sujet
http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/#howto-deployment-modwsgi
http://blog.reflectiv.net/2009/06/06/site-en-python-django-sous-apache-avec-mod_wsgi/
http://codytaylor.org/?p=14059 : Django --Quick-- Install With WSGI
http://www.ventanazul.com/webzine/tutorials/django-deployment-guide-ubuntu
http://djangodev.free.fr/blog/?p=71 : un script pour automatiser le déploiement en mod fcgi : ça peut servir d'inspiration
Dans la pratique
- Apache2 + django + mod-wsgi
aptitude install python-django lib-apache2-mod-wsgi
- ajouter dans le virtualhost
# pour le projet testwsgi WSGIScriptAlias /testwsgi /srv/www/python-mtl/testwsgi/django.wsgi # dans le cas où choisit de dire que ce n'est pas le boulot de django de servir les fichiers statics, et qu'on laisse cette charge à Apache Alias /static /srv/www/python-mtl/testwsgi/static/
créer /srv/www/python-mtl/testwsgi/django.wsgi dans le projet
import os import sys sys.path.append('/srv/www/python-mtl/') sys.path.append('/srv/www/python-mtl/testwsgi/') os.environ['DJANGO_SETTINGS_MODULE'] = 'testwsgi.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
installer les modules python utilisés par l'application. Mais il faut d'abord savoir quoi installer