OS: Ubuntu 10.04
DJANGO: Version 2.5
Apache: 2
Python: 2.6.
1. Install python, Django, Apache, mod_python
Apt-Get install
2. Edit httpd. conf
<Directory "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/"> AllowOverride None Options None Order allow,deny Allow from all </Directory> Alias /media/ "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/media/"<Location "/mysite"> SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonOption django.root /mysite PythonInterpreter mysite PythonDebug On PythonPath "['C:/Python/Django/apps'] + sys.path"</Location>
Location "/mysite" instead of location "/mysite /"
SetMaxrequestsperchild 1In this way, you do not need to restart Apache for testing during the development phase.
Alias/Media/is required on the Django admin Management Interface
Another method
cd /var/wwwsudo ln -s ~/media mediasudo ln -s ~/django_src/django/contrib/admin/media admin_media# Absolute path to the directory that holds media.# Example: "/home/media/media.lawrence.com/"MEDIA_ROOT = '/home/YOUR_USERNAME/media/'# URL that handles the media served from MEDIA_ROOT. Make sure to use a# trailing slash if there is a path component (optional in other cases).# Examples: "http://media.lawrence.com", "http://example.com/media/"MEDIA_URL = 'http://yourdomain.com/media/'# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a# trailing slash.# Examples: "http://foo.com/media/", "/media/".ADMIN_MEDIA_PREFIX = '/admin_media/'
The path used is the opposite path.
If the data type is sqllite3, databasename should also be opposite