> I recently tried to use my django project with apache2+mod_python, after
> a developement period using the integrated server. After some struggle,
> I finally have a (quite) working installation. But the admin module
> shows a really weird quirk. I have two custom applications, listed in
> INSTALLED_APPS, and which are correctly shown in admin using the
> integrated server. But when I use mod_python, one of those custom apps
> is missing from the admin page.

> Weirder is the fact that I can successfully access to the 'should-be'
> admin URLs for adding or editing hostManage objects
> (admin/hostManage/.../add/). So the hostManage app seems to be
> integrated and working (I actually can manage objects with direct URLs),
> but it's not shown on the main admin page. Any idea why?


I narrowed the problem to the fact that get_apps() from django.db.models 
does not return the same list when called from mod_python or from the 
integrated server. More precisely, it seems that for one of my 
applications, in db/models/loading.py, the load_app() function checking 
for 'models' attribute behaves differently according to the server used.

The    hasattr(mod, 'models')    call returns False for one of the 
applications using mod_python, and True for the same application using the 
integrated server. Thus, it's not listed in _app_list, and is not 
displayed on the admin page.

I added an 'assert False, h', with h = hasattr(mod, 'models') in the 
load_app() function from db/models/loading.py, and get the following with 
mod_python:

          assert False, h ...
▼ Local vars 
Variable  Value
app_name  'dNA.hostManage'
h         False
mod   <module 'dNA.hostManage' from '/var/www/dNA/hostManage/__init__.pyc'>


I removed *.pyc, and checked permissions on my folders and directories, but 
they seems to be ok since I the hasattr(mod, 'models') works from the 
shell:

>>> mod = __import__('hostManage', '', '', ['models'])
>>> mod
<module 'hostManage' from '/var/www/dNA/hostManage/__init__.pyc'>
>>> hasattr(mod, 'models')
True


After that, I'm truly lost, and I get no idea of what could be wrong. Did 
anyone has any idea why the hasattr function could return different values 
according to the server used?

-- 
Kilian CAVALOTTI                      Administrateur réseaux et systèmes
UPMC / CNRS - LIP6 (C870)
8, rue du Capitaine Scott                          Tel. : 01 44 27 88 54
75015 Paris - France                               Fax. : 01 44 27 70 00

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to