Django

39 views
Skip to first unread message

Jung Hoon Park

unread,
Feb 1, 2018, 12:16:47 PM2/1/18
to Django users
Hello, I am studying Django for my new project.
I am confronting very basic problem. 
In Tutorial Part1. Request and Response, Django Documentation, following sorce code is there.
 But I cannot find path function in "~/django.urls" directory.
Can a function be imported which has no defintion in "from location"?


polls/urls.py
from django.urls import path

from . import views

urlpatterns = [
    path('', views.index, name='index'),
]

carlos

unread,
Feb 1, 2018, 5:52:15 PM2/1/18
to django...@googlegroups.com
To create a URLconf in the polls directory, create a file called urls.py. Your app directory should now look like:

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0e088428-2daa-4ce1-b089-95e30d129948%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
att.
Carlos Rocha

Jung Hoon Park

unread,
Feb 1, 2018, 8:11:56 PM2/1/18
to Django users
Hi Rocha,
There is "from django.urls import path" statement on the top. 
Does it mean that path function is defined somewhere, not in this urls.py file?

2018년 2월 2일 금요일 오전 7시 52분 15초 UTC+9, sacrac 님의 말:
To create a URLconf in the polls directory, create a file called urls.py. Your app directory should now look like:
On Wed, Jan 31, 2018 at 8:42 PM, Jung Hoon Park <jhpar...@gmail.com> wrote:
Hello, I am studying Django for my new project.
I am confronting very basic problem. 
In Tutorial Part1. Request and Response, Django Documentation, following sorce code is there.
 But I cannot find path function in "~/django.urls" directory.
Can a function be imported which has no defintion in "from location"?


polls/urls.py
from django.urls import path

from . import views

urlpatterns = [
    path('', views.index, name='index'),
]

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.



--
att.
Carlos Rocha

carlos

unread,
Feb 1, 2018, 11:28:57 PM2/1/18
to django...@googlegroups.com
path is call from django.urls
you need use Django 2.0.x and python3 for work path

Cheers

To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.



--
att.
Carlos Rocha

Jung Hoon Park

unread,
Feb 2, 2018, 8:42:26 PM2/2/18
to Django users
Thank you very much Rocha, I come to understand  that import statement checks the module and its submodule specified in from clause.

2018년 2월 2일 금요일 오후 1시 28분 57초 UTC+9, sacrac 님의 말:



--
att.
Carlos Rocha
Reply all
Reply to author
Forward
0 new messages