Please try this: Here app_name
is name of the app you written home
function.
from django.urls import path
from .app_name import home
urlpatterns = [
path('',home, name='home'),
]
Function views
- Add an import:
from my_app import views
- Add a URL to urlpatterns:
path('', views.home, name='home')
Class-based views
3. Add an import: from other_app.views import Home
4. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
5. Import the include() function: from django.urls import include,
path
6. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
The urlpatterns
list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/