Using apache2 + mod_python, the admin interface do not display all of the applications listed in INSTALLED_APPS, while all those applications correctly appear in the main admin page using the integrated web server.
Weirder is the fact that, for the missing app, the 'should-be' admin URLs for adding or editing objects (admin/app/object/add/) can be successfully accessed. It seems that the missing application is correctly seen and working (objects actually can be managed with direct URLs), but it's not shown on the main admin page.
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 the 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 the hostManage application 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.
Adding
h = hasattr(mod, 'models')
assert False, h
in the load_app() function from db/models/loading.py gives the following with mod_python:
| 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
So, I can't figure out why, but the hasattr(mod, 'models') function returns different values according to the server used. And I guess it's not thewanted behavior. ;)
for reference, this issue has been discussed there and there