As the previous reply suggests, what Django version are you using?
Using django.conf.urls is a Django 1.11 and below utility function,
Django 2.x uses this
from django.urls import path
*If you are using Django 1.x* this is what your urls.py should look like:
from django.conf.urls import urlfrom django.contrib import admin
from . import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^index/', views.index, name="index"),]
*If you're using Django 2.x* this is what your urls.py should look like
from django.urls import pathfrom django.contrib import admin
from . import views
urlpatterns = [
path('admin/', admin.site.urls),
path('index/', views.index, name="index"),]
On Mon, Jun 4, 2018 at 3:12 PM, Aphiso Media <[email protected]> wrote:
> Whats version are you using? Im on mobile so i cant open urls.py.
>
> If you're using a version earlier than 2.0 you need to use url instead of
> path.
>
> Do you have from django.urls import path?
>
> On Mon, Jun 4, 2018, 4:29 PM anguboy <[email protected]> wrote:
>
>> i am new in django, so in my first app ,am stack at mapping the URL and I
>> get an error that can not import name 'path' ,,which is in the tmn(my_app)
>> folder , please help
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> 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/88ca007c-c716-4050-a7ce-7bb1b7214fe0%
>> 40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/88ca007c-c716-4050-a7ce-7bb1b7214fe0%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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/CAJiup7FSUuROtUXyArQqVgFTfOSnf9oBn-zY6TFWyttib%2B5g-Q%
> 40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAJiup7FSUuROtUXyArQqVgFTfOSnf9oBn-zY6TFWyttib%2B5g-Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To post to this group, send email to [email protected].
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/CAE-E-_33zTiPH4sDNc1mY1X0N_RD6nmGzTGfWODKDfzeULrytw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.