I decided to raise the above mentioned environment on my laptop, but it turned out to be not as easy as it seemed to me, and that made me write this article. Hope it helps beginners.
What is required
Probably not hard to guess, but I decided to write:
Denwer and ActivePython 2.5
I think we can safely omit the installation process of the first two components of the list. We assume that Denver is as proposed by default:
C:\WebServers
, Z: \ Virtual Disk
Python should then be located at
C:\WebServers\usr\local\python
However, before installing django, we need to perform some actions. Since denwer is set fairly separate from the entire system, it will be necessary to add the path to the interpreter to the Path variable.
')
For those who do not know - go to the properties of the system> Advanced options> Environment variables

and enter the path to the python interpreter into the Path variable: C: \ WebServers \ usr \ local \ python \

Then you can check if we can contact the interpreter without registering the path to it. In the command line we execute
python -V
and in return should receive:
Python 2.5.1
.
Installing mod_python, psycopg and \ or mysql-python
If you, like me, have downloaded the Windows installers (.exe) of mod_python and database libraries, you will surely come across the fact that these same installers will swear at the lack of data about the installed python 2.5 in the windows registry.
We solve this problem by entering the data manually:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\InstallPath]
@="z:\\usr\\local\\python"
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\InstallPath\InstallGroup]
@="Python 2.5"
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\Modules]
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\PythonPath]
@="z:\\usr\\local\\python\\Lib;z:\\usr\\local\\python\\DLLs;z:\\usr\\local\\python\\Lib\\lib-tk"
After that, the installation takes place without problems. You can only mention that during the installation of mod_python you will need to specify the folder where Apache is installed - C: \ WebServers \ usr \ local \ apache \.
Install django
Perhaps this part does not even deserve the title, but, nevertheless, for those who are
accustomed to bitrix , did not look into the documentation, I will literally quote it.
Unpack the archive, run the command line and go to the directory where django was unpacked. We carry out:
python setup.py install
everything.
Configuring mod_python to work on a specific denwer virtual host
Suppose that we want to place our project on one of the virtual hosts, while on others at this moment other projects can continue to turn on php or on something else.
Our virtual host will require individual configuration, and Denver creates blocks of virtual hosts automatically and in a pattern. With virtual hosts, it does everything in the home folder.
In order for one of these hosts to define its own specific parameters, this must be done in httpd.conf. However, this point is described in some detail in the httpd.conf file itself.
Suppose we would like to have a project on django at dproject.dev. I did the following: created a directory
C:\WebServers\home\dproject.dev\www
,
Then I moved to this directory on the command line and created a project there.
cd C:\WebServers\home\dproject.dev\www\
python C:\WebServers\usr\local\python\Scripts\django-admin.py startproject dproject
cd C:\WebServers\home\dproject.dev\www\
python C:\WebServers\usr\local\python\Scripts\django-admin.py startproject dproject
,
as a result, the directory
C:\WebServers\home\dproject.dev\www\dproject
with the project files should appear.
Finally, the virtual host block that is added to httpd.conf:
<VirtualHost 127.0.0.1:80> DocumentRoot "Z:/home/dproject.dev/www/dproject" ServerName "dproject.dev" ServerAlias "dproject.dev" "www.dproject.dev" ScriptAlias /cgi/ "/home/dproject/cgi/" ScriptAlias /cgi-bin/ "/home/dproject/cgi-bin/ <Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE dproject.settings PythonDebug On PythonPath ['Z:/home/dproject.dev/www'] + sys.path </Location> Alias "/admin_media/" "Z:/usr/local/python/Lib/site-packages/django/contrib/admin/media/" <Location "/admin_media/"> SetHandler None </Location> </VirtualHost>
<VirtualHost 127.0.0.1:80> DocumentRoot "Z:/home/dproject.dev/www/dproject" ServerName "dproject.dev" ServerAlias "dproject.dev" "www.dproject.dev" ScriptAlias /cgi/ "/home/dproject/cgi/" ScriptAlias /cgi-bin/ "/home/dproject/cgi-bin/ <Location "/"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE dproject.settings PythonDebug On PythonPath ['Z:/home/dproject.dev/www'] + sys.path </Location> Alias "/admin_media/" "Z:/usr/local/python/Lib/site-packages/django/contrib/admin/media/" <Location "/admin_media/"> SetHandler None </Location> </VirtualHost>
Almost everything that is written here is explained in the documentation, I will only explain that the alias / admin_media / and the corresponding Location block are needed for the static django admin panel (img, css, etc). In order for the django admin to use this address, you need to fix the settings.py of the created project:
ADMIN_MEDIA_PREFIX = '/admin_media/'
That's all. If something went wrong with you, I will try to help in the comments.
Conclusion
I will be grateful for all the practical advice.
And still it would be possible to add in this article instructions for connecting wsgi_module for the same project.
And since I’m not very good at windows settings, I couldn’t make it so that I don’t have to type python each time to execute the Python program ... It would be much better
.\manage.py startapp