Hi all,

I'd like to inquire about the design decision to recommend users to include the project name in DJANGO_SETTINGS_MODULE and ROOT_URLCONF, for example:

When using django-admin.py, you can either set the environment variable once, or explicitly pass in the settings module each time you run the utility...

export DJANGO_SETTINGS_MODULE=mysite.settings

<https://docs.djangoproject.com/en/dev/topics/settings/>

A string representing the full Python import path to your root URLconf. For example: "mydjangoapps.urls"

<https://docs.djangoproject.com/en/dev/ref/settings/#root-urlconf>

But "mysite" is a package, and Django wants us to be able to import "mysite.settings" and "mysite.urls" (in fact, the latter is the default ROOT_URLCONF setting). In order to make that possible, setup_environ does some magic... This bit of clever causes a boat-load of problems...

<http://groups.google.com/group/django-developers/browse_frm/thread/44b70a37ff73298b>

My question is, why exactly Django wants us to be able to import "mysite.settings" and "mysite.urls"? Wouldn't it be much simpler and better if we could just import settings and urls?

As an experiment, I've removed the "setup_environ(settings_mod)" from my manage.py, which adds the project's parent directory to the PYTHONPATH, and it seems to work so far. I think that mod_wsgi uses an environment without this addition as well, leading to tickets like this:

<https://code.djangoproject.com/ticket/15058>
<https://code.djangoproject.com/ticket/16673>

Is there any reason not to drop the project name part of DJANGO_SETTINGS_MODULE and ROOT_URLCONF, to reduce the risk of confusion, pollution, double imports and bad practice app coding in Django?

Cheers, Chris.
--
Aptivate | http://www.aptivate.org | Phone: +44 1223 760887
The Humanitarian Centre, Fenner's, Gresham Road, Cambridge CB1 2ES

Aptivate is a not-for-profit company registered in England and Wales
with company number 04980791.

--
You received this message because you are subscribed to the Google Groups "Django 
developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to