lundi 19 mai 2014

Apache - une manière de paramétrage du serveur de production pour Django - Stack Overflow


As a Django (and Python) newbie i'm struggling with next:


i have server with multiple PHP web sites on it and now i need to deploy my first django app on the same server. As i knew in advance it will be a tough job to make my app to work on my web server (because of bunch of settings to change), i've wanted first to create django 'hello world' project on my web server ('django-admin.py startproject test') just to make sure it will work as expected. Unfortunately, i'm facing some problems even with that basic Django thing.


This is my Apache wsgi.conf (configuration file regarding mod_wsgi):


LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so
WSGIScriptAlias / /home/user/www/djangotest.com/test/wsgi.py
WSGIPythonPath /home/user/www/djangotest.com
<Directory /home/user/www/djangotest.com/test>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>

This works fine - i get Django succes page when i visit my djangotest.com website, but then every other web site on my web server is being crashed - i also get Django success page when i visit their url's although they don't have anything with Django! If i change WSGIScriptAlias to:


WSGIScriptAlias /test /home/user/www/djangotest.com/test/wsgi.py

my other web sites return to normal state, but then i have to visit djangotest.com/test in order to get Django response (if i visit just djangotest.com i get directory structure of my web site), and also i don't get Django success page anymore but Django 404 page!


So, my final question is: how to make Django app to work when visiting 'base url' (djangotest.com) and to keep other web sites on my server running?


Do i maybe need to change folder structure of my Django project (or something else)? Now it looks like this (standard django structure):


djangotest.com/
manage.py
test/
wsgi.py
urls.py
settings.py
init.py


As a Django (and Python) newbie i'm struggling with next:


i have server with multiple PHP web sites on it and now i need to deploy my first django app on the same server. As i knew in advance it will be a tough job to make my app to work on my web server (because of bunch of settings to change), i've wanted first to create django 'hello world' project on my web server ('django-admin.py startproject test') just to make sure it will work as expected. Unfortunately, i'm facing some problems even with that basic Django thing.


This is my Apache wsgi.conf (configuration file regarding mod_wsgi):


LoadModule wsgi_module /usr/lib64/httpd/modules/mod_wsgi.so
WSGIScriptAlias / /home/user/www/djangotest.com/test/wsgi.py
WSGIPythonPath /home/user/www/djangotest.com
<Directory /home/user/www/djangotest.com/test>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>

This works fine - i get Django succes page when i visit my djangotest.com website, but then every other web site on my web server is being crashed - i also get Django success page when i visit their url's although they don't have anything with Django! If i change WSGIScriptAlias to:


WSGIScriptAlias /test /home/user/www/djangotest.com/test/wsgi.py

my other web sites return to normal state, but then i have to visit djangotest.com/test in order to get Django response (if i visit just djangotest.com i get directory structure of my web site), and also i don't get Django success page anymore but Django 404 page!


So, my final question is: how to make Django app to work when visiting 'base url' (djangotest.com) and to keep other web sites on my server running?


Do i maybe need to change folder structure of my Django project (or something else)? Now it looks like this (standard django structure):


djangotest.com/
manage.py
test/
wsgi.py
urls.py
settings.py
init.py

0 commentaires:

Enregistrer un commentaire