﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
2438	django.db.models get_apps() return different results according to the server used	kilian <kilian.cavalotti@…>	nobody	"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 [http://groups.google.com/group/django-users/browse_frm/thread/2d962fb4a4640569/87e4a535dc74149c there] and [http://groups.google.com/group/django-developers/browse_frm/thread/49bad5f86e982099/87e4a535dc74149c there]''
"	Bug	closed	Core (Other)	dev	Normal	worksforme		kilian.cavalotti@… mattimustang@… oliver@… lrekucki@…	Accepted	0	0	0	0	0	0
