Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python NameError: name 'include' is not defined [closed]

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?

like image 703
eloiletagant Avatar asked Dec 26 '15 11:12

eloiletagant


People also ask

How do I fix NameError is not defined in Python?

The Python "NameError: name is not defined" occurs when we try to access a variable or function that is not defined or before it is defined. To solve the error, make sure you haven't misspelled the variable's name and access it after it has been declared.

What causes NameError in Python?

NameError is raised when the identifier being accessed is not defined in the local or global scope.

What is the NameError in Python?

NameError is a kind of error in python that occurs when executing a function, variable, library or string without quotes that have been typed in the code without any previous Declaration. When the interpreter, upon execution, cannot identify the global or a local name, it throws a NameError.


1 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 
like image 115
Rahul Gupta Avatar answered Sep 21 '22 13:09

Rahul Gupta