﻿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
13612	manage.py imports settings.py even when --settings is used	Artem Skoretskiy	Graham King	"manage.py file has an option to use settings file you need:
{{{
./manage.py runserver --settings=mycustomsettings
}}}

But it refuses running if settings file is not present:

{{{
Error: Can't find the file 'settings.py' in the directory containing './manage.py'. It appears you've customized things.
You'll have to run django-admin.py, passing it your settings module.
(If the file settings.py does indeed exist, it's causing an ImportError somehow.)
}}}

settings.py file should not be mandatory in that case!

I have a monkey-patch for manage.py file:
{{{
#!/usr/bin/env python

# HACK BEGIN
import sys
from optparse import OptionParser, make_option
settings_module = OptionParser(option_list=[make_option('--settings')]).parse_args(sys.argv[:])[0].settings
# HACK END

from django.core.management import execute_manager

if not settings_module:                     # HACK
    try:
        import settings # Assumed to be in the same directory.
    except ImportError:
        import sys
        sys.stderr.write(""Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n"" % __file__)
        sys.exit(1)
else:                                       # HACK
    settings = __import__(settings_module)  # HACK

if __name__ == ""__main__"":
    execute_manager(settings)
}}}"	Bug	closed	Core (Management commands)	dev	Normal	fixed	manage.py django-admin.py settings	tonn81@…	Accepted	1	0	0	1	0	0
