Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

python - Django Admin: not seeing any app (permission problem?)

I have a site with Django running some custom apps. I was not using the Django ORM, just the view and templates but now I need to store some info so I created some models in one app and enabled the Admin.

The problem is when I log in the Admin it just says "You don't have permission to edit anything", not even the Auth app shows in the page. I'm using the same user created with syncdb as a superuser.

In the same server I have another site that is using the Admin just fine.

Using Django 1.1.0 with Apache/2.2.10 mod_python/3.3.1 Python/2.5.2, with psql (PostgreSQL) 8.1.11 all in Gentoo Linux 2.6.23

Any ideas where I can find a solution?

Thanks a lot.

UPDATE: It works from the development server. I bet this has something to do with some filesystem permission but I just can't find it.

UPDATE2: vhost configuration file:

<Location />
  SetHandler python-program
  PythonHandler django.core.handlers.modpython
  SetEnv DJANGO_SETTINGS_MODULE gpx.settings
  PythonDebug On
  PythonPath "['/var/django'] + sys.path"
</Location>

UPDATE 3: more info

  • /var/django/gpx/init.py exists and is empty
  • I run python manage.py from /var/django/gpx directory
  • The site is GPX, one of the apps is contable and lives in /var/django/gpx/contable
  • the user apache is webdev group and all these directories and files belong to that group and have rw permission

UPDATE 4: confirmed that the settings file is the same for apache and runserver (renamed it and both broke)

UPDATE 5: /var/django/gpx/contable/init.py exists

This is the relevan part of urls.py:

urlpatterns = patterns('',
                       (r'^admin/', include(admin.site.urls)),
                      )
urlpatterns += patterns('gpx',
   (r'^$',                         'menues.views.index'),
   (r'^adm/$',                     'menues.views.admIndex'),
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Hopefully this helps someone, but we had this same problem because someone added a different authentication backend to settings.py and did not keep the default ModelBackend. Changing the setting to:

AUTHENTICATION_BACKENDS = (
    'auth.authentication.EmailBackend',
    'django.contrib.auth.backends.ModelBackend',
)

fixed it for us.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...