The reason you cannot import path is because it is new in Django 2.0 as is mentioned here: https://docs.djangoproject.com/en/2.0/ref/urls/#path.
On that page in the bottom right hand corner you can change the documentation version to the version that you have installed. If you do this you will see that there is no entry for path
on the 1.11
docs.
pip install --upgrade django
pip3 install --upgrade django
python -m django --version # 2.0.2
python3 -m django --version # 2.0.2
Use url instead of path.
from django.conf.urls import url
urlpatterns = [
url('', views.homepageview, name='home')
]
Python 2 doesn't support Django 2. On a Mac once you've installed Python 3 and Django 2 run the following command from shell to run your app while keeping path:
python3 manage.py runserver
Even if you have upgraded and are on a mac you will, by default, run Python 2 if you're entering the following command:
python manage.py runserver
The version of Django will then be wrong and you will see import errors for path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With