Creating Views and Testing the App

  1. Open home/views.py 
    • If you are following this lab from our previous lab Getting Started With Django, the views.py file may look like this:
    •  
    •  
    • Modify the views.py like this to render the templates/home/home.html file when the request is made on the server:
    •  

    • The final views.py file will look like this:
    •  
    •  
  1. Run server using manage.py to see the homepage on http://127.0.0.1:8000/  
  2. Check if the static files (Images in this case) are accessible:
Discussion

13

0