Extended "Hello world" application to name user

From MyWiki
Revision as of 15:53, 18 March 2021 by George2 (Talk | contribs)

Jump to: navigation, search

This is based on the simple "Hello World" application, so we need a working version of it to modify
We will add modifications to the hello apps views.py and urls.py files as follows:
In the views.py add the following lines:

def brian(request):
    return HttpResponse("Hello, Brian!")
 
def david(request):
    return HttpResponse("Hello, David!")


And in the urls.py file add a couple of extra lines

urlpatterns = [
    path("", views.index, name="index"),
    path("brian", views.brian, name="brian"),
    path("david", views.david, name="david")
]