Ярлыки

четверг, 25 октября 2012 г.

Install Django on UbuntuServer

How I installed Django on UbuntuServer 11.04 - the Natty Narwhal
python2
django1.3

Apache already installed. 

Installing apxs2: 
 sudo apt-get install apache2-threaded-dev

Installing mod_python-3.3.1:
sudo apt-get install libapache2-mod-python

stop Apache:
sudo /etc/init.d/apache2 stop

Than we write settings in Apache config file (for me - /etc/apache2/apache2.conf). This settings bind Django with URL:
#Connect to mod_python:
LoadModule python_module /usr/lib/apache2/modules/mod_python.so

#Connect Django with URL:
<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE settings
    PythonDebug Off
    PythonPath "['/home/vinger4/vinger4site','/usr/local/lib/python3.2/dist-packages/django'] + sys.path"
    PythonAutoReload Off
</Location>

Correcting urls.py and settings.py
You must delete prefix of you site (in my case - vinger4site), because it wrote in PythonPath for Apache (please, see previous paragraph).

start Apache
sudo /etc/init.d/apache2 start

Now each request to the server must go through Apache.

Комментариев нет:

Отправить комментарий