In order to configure Mod_python-based Django, first install the Apache with the available Mod_python module. This usually means that there should be a LoadModule directive in the Apache configuration file. It looks like this:
LoadModule python_module/usr/lib/apache2/modules/mod_python.so
Then, edit your Apache configuration file and add a directive this ties a specific URL path to a specific Django Installation. For example:
SetHandler python-program pythonhandler django.core.handlers.modpython SetEnv django_settings_module Mysite.settings Pythondebug Off
Be sure to replace the Mysite.settings project in Django_settings_module with the content that corresponds to your site.
It tells Apache that any URLs after the/this path are handled using Django's mod_python. It passes the value of django_settings_module, so that Mod_python knows which configuration to use at this point.
Note that the "" command is used instead of "". The latter is used to point to a location in your file system, however ""
System MESSAGE:WARNING/2 (
, line 403); backlinkinline literal start-string without end-string. System MESSAGE:WARNING/2 (
, line 403); backlinkinline literal start-string without end-string. System MESSAGE:WARNING/2 (
, line 403); backlinkinline literal start-string without end-string. System MESSAGE:WARNING/2 (
, line 403); backlinkinline literal start-string without end-string. System MESSAGE:ERROR/3 (
, line 405) unexpected indentation.
A URL location that points to a Web site. ````
System MESSAGE:WARNING/2 (
, line 405), backlink Inline literal start-string without end-string.< C25/>system MESSAGE:WARNING/2 (
, line 405); backlink Inline literal start-string without end-string.
Apache may not only run in an environment where you are normally logged in, but will also run in a different user environment, or there may be different file paths or Sys.path. You need to tell Mod_python how to find your project and the location of Django.
PythonPath "['/path/to/project ', '/path/to/django '] + sys.path"
You can also add some other instructions, such as Pythonautoreload Off, to improve performance. View the Mod_python documentation for a detailed list of instructions.
Note that you should set Pythondebug OFF on the production server. If you use Pythondebug on, your users will see ugly (and exposed) Python backtracking information when the program generates an error. If you put the pythondebug on, when there are some errors in Mod_python, your users will see the ugly (and also revealing) Python's error tracking information.
All requests to your site (or the virtual host after you use the command) will be processed by Djanog after restarting Apache.