On Oct 8, 2:08 am, Gerard Petersen <[EMAIL PROTECTED]> wrote:
> When the project dir is named 0.1 instead of djapp I get a trace (see below) 
> that it has no module 0.1. Where and why does django look at the name of the 
> parent (project) dir?

In Python, you can happily put any directory into the PYTHONPATH (even
if the final path component of it would be an invalid module name),
and then load modules (with valid names) from within that directory.
You might reasonably expect the same to work here if you put the
project directory itself into the PYTHONPATH and then import settings,
urlconf, and apps relative to that.  But when Django sets up your
environment (in django.core.management.setup_environ) it does a bit of
magic to figure out the parent dir of your project and make the
project directory itself importable as a module.  In other words,
Django requires that your project directory itself be a valid Python
module name, even if you never import it yourself.

This is not just "normal Python" behavior; arguably it should be noted
in the docs.

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

Reply via email to