From the course: Secure Coding in Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Secure the end point

Challenge: Secure the end point - Python Tutorial

From the course: Secure Coding in Python

Start my 1-month free trial

Challenge: Secure the end point

(upbeat energetic music) - [Instructor] It's time we put what we've learned to the test by securing a small Python web application. Here we are at 02 04 in a small Django web application called asserto. Here, like many Django web applications, you'll find a sub-module with the same name, also called asserto, and within that, there's a views.py file so basically 02 04, asserto, asserto, views.py. In line six, you'll see a view function index that checks if the user is authenticated in line eight. And if they are, we send them a response with a JSON of success equals true and status of 200 OK. In line 11, if the user is not authenticated, we send success is false and a status of 403 FORBIDDEN. So let's run this with the standard Django development server and see what happens. So let's head over to our terminal, and I'm going to do pipenv run python manage.py runserver. So it's telling me that it's listening in localhost…

Contents