Monday, June 4, 2018

Re: error: can not import the name 'path'

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 url  from 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 path  from 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 <aphisosys@gmail.com> 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 <emmangu69@gmail.com> 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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/88ca007c-c716-4050-a7ce-7bb1b7214fe0%40googlegroups.com.
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAJiup7FSUuROtUXyArQqVgFTfOSnf9oBn-zY6TFWyttib%2B5g-Q%40mail.gmail.com.

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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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/CAE-E-_33zTiPH4sDNc1mY1X0N_RD6nmGzTGfWODKDfzeULrytw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment