Python NameError: name 'include' is not defined

Question:

I’m currently developing a website with the framework Django (I’m very beginner), but I have a problem with Python: since I have created my templates, I can’t run server anymore for this reason (the stack trace points to a line in file urls.py):

<stacktrace>
...
path('apppath/', include('myapp.urls')),
NameError: name 'include' is not defined

Where can I import include from?

Asked By: eloiletagant

||

Answers:

Guessing on the basis of whatever little information provided in the question, I think you might have forgotten to add the following import in your urls.py file.

from django.conf.urls import include
Answered By: Rahul Gupta
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.