basic Python questions on from-import

This is the place for queries that don't fit in any of the other categories.

basic Python questions on from-import

Postby anaconda_wly » Thu Aug 01, 2013 4:18 am

I'm reading Django source code and encountered some questions infect related python knowledge I guess. There's a system generated file urls.py as below:

Code: Select all
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
)


I didn't found patterns, include, url in Python27\Lib\site-packages\django\conf\urls folder. As my understanding, django.conf.urls gives the searching path beginning from a predefined sys location like PATH ENV. No files under \urls named as patterns, include or url. No files under \urls contain class or function names as patterns, include or url.
Could anyone tell me the reason? It's running very well on my machine. But I can't understand the logic.
Last edited by Yoriz on Thu Aug 01, 2013 5:47 am, edited 1 time in total.
Reason: Added code tags
anaconda_wly
 
Posts: 2
Joined: Thu Aug 01, 2013 3:52 am

Re: basic Python questions on from-import

Postby Mekire » Thu Aug 01, 2013 5:56 am

They are inside the __init__ in the urls folder:

https://github.com/django/django/blob/master/django/conf/urls/__init__.py

-Mek
User avatar
Mekire
 
Posts: 987
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: basic Python questions on from-import

Postby anaconda_wly » Thu Aug 01, 2013 8:38 am

Mek, Thank you very much. Your reminding is very helpful. I can continue now.
anaconda_wly
 
Posts: 2
Joined: Thu Aug 01, 2013 3:52 am


Return to General Coding Help

Who is online

Users browsing this forum: No registered users and 4 guests