﻿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
9751	"project_directory calculated incorrectly when ""settings"" is a directory (breaks 'startapp')"	Chris Lamb	George Song	"When a Django project's settings is contained in directory-style module instead of the usual ""`settings.py`"" file-based module, `project_directory` (as returned from setup_environ) is calculated incorrectly as ""`settings`"", which results in--at least--'`startapp`' creating new apps inside the settings directory.

Whilst the use of a settings directory is non-standard, it helps when splitting larger or more complicated configurations, such as when settings change depending on the hostname, etc. Indeed, this would be completely transparent to Django if it wasn't parsing the `__file__` attribute.

To reproduce:

{{{
 % django-admin.py startproject myproject
 % cd myproject
 % mkdir settings
 % mv settings.py settings/__init__.py
 % ./manage.py startapp myapp
 % tree
 |-- __init__.py
 |-- manage.py
 |-- settings
 |   |-- __init__.py
 |   `-- myapp                              # <----
 |       |-- __init__.py
 |       |-- models.py
 |       `-- views.py
 `-- urls.py

Patch attached."		closed	Core (Management commands)	1.0		fixed	startapp,settings,module	robillard.etienne@…	Ready for checkin	1	0	0	0	0	0
