ROOT_URLCONF = 'projectname.urls'
In my project I can import projectname and projectname.urls.
generally all django project have a __init__.py file which makes it a
module, so in your case soco-site should be a valid module with a
normal django setup.
You said that '/Users/roy/S7/soco/soco-site' was printed which sounds
just about correct since that would allow you to import the soco-site
module. So you should have been able to do "import soco-site" and
"import soco-site.urls". If you will type "import url" python will
look if it belong to any of the directories on the python path, and it
would therefore find in under '/Users/roy/S7/soco/soco-site'. If
multiple directories had a url.py then there would be some conflict,
maybe If you have multiple django projects for example, which is why
I'm guessing django specifies it using the project name. Or it could
just be conversion since this is the recommended way as Shawn said.
Since
On Apr 3, 6:15 pm, Roy Smith <r...@panix.com> wrote:
> On Apr 3, 4:58 pm, Shawn Milochik <sh...@milochik.com> wrote:
>
> > In short, it has to be on your PYTHONPATH or in the local directory.
>
> OK, then I'm still not getting how this works. The full path to my
> setting and urls files are:
>
> /Users/roy/s7/soco/soco-site/settings.py
> /Users/roy/s7/soco/soco-site/urls.py
>
> If I have in that settings file:
>
> ROOT_URLCONF = 'soco-site.urls'
>
> and start up my server from the soco-site directory, it finds the urls
> file. How? If I print out sys.path from inside settings.py, it
> includes /Users/roy/S7/soco/soco-site, but not /Users/roy/S7/soco.
> Even stranger, "soco-site" is not a valid module name. If I do
> something like "import soco-site.urls", I (as expected) get a syntax
> error. So what's the process that gets from the string 'soco-
> site.urls' to a valid module import? Is django handing the string
> 'soco-site.urls' directly to imp.loadmodule(), or something like that,
> or is it parsing the string in django application code and doing
> something magic with it?
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment