O'Reilly logo
live online training icon Live Online training

Beginning Python Web Development with Django

An Introduction to Web Development Paradigms and Tools

Andrew Pinkham

The web has radically changed the world in the last thirty years, and continues to connect more and more people. As software becomes increasingly service-oriented to match this growth, being able to leverage web technologies will become a prerequisite for businesses of all kinds. Knowledge of the web, and how to allow computers to communicate with both humans and other computers, is indispensable.

Python is the fastest growing language in the industry. The core development team’s focus on design and consistency makes it a joy to program with, and the versatility of Python’s ecosystem allows for horizontal career changes like very few other languages.

This primer will focus on the fundamental protocols of the web and will teach you how to use Python to write web applications. The class will start by examining the problems web applications must solve, and explain the solutions offered by many of the tools in Python. This will allow the class to then build a web application in Python using Django, one of the world’s most popular web frameworks, used by sites like Instagram, Disqus, Pinterest, the Washington Post, and many, many more.

What you'll learn-and how you can apply it

  • Understand how the web works
  • Use Python and Django to create a backend web application
  • Learn how to serve HTML pages over HTTP with Django templates
  • Structure data in a PostgreSQL database to ensure application scalability

This training course is for you because...

  • You are a new to web technologies, or looking to learn more about HTTP and servers
  • You want to see Python and Django in action!
  • You want to learn how to build websites in Django and the Django Rest Framework

Prerequisites

  • Knowledge of object-oriented programming principles
  • Experience with Python, or knowledge of basic Python syntax
  • Knowledge of Python Decorators helpful, but not necessary
  • Knowledge of Distributed Version Control Systems (Git in particular)

Students will be expected to have Python 3.6 and the latest version of Docker installed before the class.

About your instructor

  • Andrew Pinkham has spent the last six years programming for the web. He is the founder and lead engineer at JamBon Software, which provides development consulting services. He is the author of Django Unleashed and provides instruction in Python and Django. Andrew specializes in web and mobile products, but is also passionate about usability, security and distributed systems. He is a graduate of Dartmouth College and currently resides in Boston, MA.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Segment 1 Learn about HTTP Methods, Requests, and Responses (Length: 10 minutes)

  • Instructor will lecture with slides
  • Participants will listen and ask questions

Segment 2 Understand the differences between Libraries and Frameworks (or: Software as a Solution) (Length: 10 minutes)

  • Instructor will discuss the purpose of libraries and frameworks
  • Participants will listen and ask questions

Segment 3 Discover The Zen of Python and Django (Length: 10 minutes)

  • Instructor will compare Python and Django to other languages and frameworks
  • Participants will listen and ask questions

5 minute Break

Segment 4 Dive into Python Development Environments (and Docker) (Length: 30 minutes)

  • Instructor will demonstrate how to download the repository and run the project locally and in Docker
  • Participants will download the code with Git, run the application in Docker

Segment 5 Specify the Project for Today’s Training (Length: 10 minutes)

  • Instructor will show web application specification and demonstrate a live version
  • Participants will browse a live version of the site, ask questions about spec

Segment 6 Start a new Django Project (Length: 15 minutes)

  • Instructor will show how to create a new project in Django, first with Django and then with Cookiecutter
  • Participants will watch (they already have this scaffolding in the project)

Segment 7 Build a First Web Page (Length: 5 minutes)

  • Instructor will write Python code
  • Participants will mimic this Python code

5 minute Break

Segment 8 Structure Data in Django for Databases (PostgreSQL) (Length: 30 minutes)

  • Instructor will lecture with slides, demonstrate how to write a model, and show the class documentation
  • Participants will first watch, and then create their own models

Segment 9 Define an API Endpoint for your Data (Length: 30 minutes)

  • Instructor will build a single API endpoint for list items
  • Participants will build a single API endpoint for lists

10 Minute Break

Segment 10 Generate HTML with Django (Length: 30 minutes)

  • Instructor will use Django templates to generate HTML pages
  • Participants will extend a template to show HTML

Segment 11 Follow the DRY Principle to Link Content (Length: 15 minutes)

  • Instructor will use reverse and URL template tag to keep the site DRY
  • Participants will enhance the existing templates with a call to URL

Segment 12 Manage Static Assets like CSS and JavaScript (Length: 15 minutes)

  • Instructor will show how to serve CSS and JavaScript assets
  • Participants will follow along to understand the process

Segment 13 Integrate a Django App to enable User Authentication (Length: 10 minutes)

  • Instructor will demonstrate how to quickly enable user authentication in Django
  • Participants will follow along to understand the process