﻿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
12231	The project path is incorrectly build, it wipe the namespace	mleduc	nobody	"If by example your django is in an egg like
{{{
my.site.project
}}}
If you call the django core execution manager with:
{{{
mod = __import__('my.site.project')
django.core.management.execute_manager(mod)
}}}
Your project will not be found cause the django core is declaring the main DJANGO_SETTINGS_MODULE with:

django.core.management.__init__:
{{{
...
project_directory, settings_filename = os.path.split(p)
if project_directory == os.curdir or not project_directory:
   project_directory = os.getcwd()
project_name = os.path.basename(project_directory)
...
os.environ['DJANGO_SETTINGS_MODULE = '%s.%s' % (project_name, settings_name)
...
}}}
The project_name variable represent only the first level of the project egg. It could not work with a multilevel package and we now have to use the variable 'original_settings_path' which is just optional.

The solution maybe to use the special __package__ variable of the settings_mod module. 

I attach a patch with this ticket whick correct this problem.


"	Bug	closed	Core (Other)	dev	Normal	worksforme	package		Accepted	1	0	0	1	0	0
