Jan Meier
未读,2010年6月11日 04:49:252010/6/11登录即可回复作者
登录即可转发
您无权在此群组中删除帖子
要么此群组的电子邮件地址为匿名状态,要么您得查看成员电子邮件地址权限才能查看原始帖子
收件人 Django users
Hi,
I am serving my django project with mod_python and ran into a problem
regarding the admin interface (django.contrib.admin). If DEBUG = False
is set in settings.py the admin interface generates 404 error messages
when clicking on any of my models, for example to add a new entry. The
django shipped models work without any problems. If I set DEBUG = True
everything works fine as expected. It is odd that the models show up
in the interface but clicking them generates 404 errors.
The problem occurs with django-1.1.2 and django-1.2.1, django-1.0.*
works fine.
I tested this on debian and ubuntu with different projects. To hunt
the problem down I tested with mod_wsgi, which has the same problem.
Here is my apache configuration with mod_python:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/jan/tmp/my_project
Options Indexes FollowSymLinks
<Location />
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonPath "['/home/jan/tmp/my_project/', ] +
sys.path"
SetEnv DJANGO_SETTINGS_MODULE my_project.settings
PythonOption django.root /mynew
PythonDebug On
</Location>
<Location "/static/">
SetHandler None
</Location>
<Location "/media">
SetHandler None
</Location>
</VirtualHost>
Here is my settings.py configuration file:
DEBUG = False
TEMPLATE_DEBUG = DEBUG
[...]
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
ROOT_URLCONF = 'my_project.urls'
TEMPLATE_DIRS = (
'/home/jan/tmp/my_project/templates'
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'my_project.my_app',
)
My urls.py url configuration file looks like this:
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
)
And my model my_app/models.py looks as follows:
from django.db import models
from django.contrib import admin
class Blubb(models.Model):
x = models.IntegerField()
admin.site.register(Blubb)
Any ideas what could be wrong?
Kind regards,
Jan