When I am defining the URL patterns in django version 2.1.4 , I am getting an error. please show me a path

96 Views Asked by At

I am trying to run the web application named test app.I have imported all the modules correctly and crosschecked them.The error is below with the code. Error on running the project from CMD: path('about/',views.about), AttributeError: module 'testapp.views' has no attribute 'about'

URLs.py:

from django.contrib import admin
from django.urls import path
from testapp import views
urlpatterns = [
    path('about/',views.about),]

views.py

from django.shortcuts import render
from django.http import HttpResponse
def about(request):
    s="<h1> This is an about page</h1>"
    return HttpResponse(s)
0

There are 0 best solutions below