▶Book Description
This project-based guide will give you a sound understanding of Django 2.0 through three full-featured applications. It starts off by building a basic IMDB clone and adding users who can register, vote on their favorite movies, and upload associated pictures. You will learn how to use the votes that your users have cast to build a list of the top 10 movies. This book will also take you through deploying your app into a production environment using Docker containers hosted on the server in Amazon's Electric Computing Cloud (EC2).
Next, you're going to build a Stack Overflow clone wherein registered users can ask and answer questions. You will learn how to enable a user asking a question to accept answers and mark them as useful. You will also learn how to add search functionality to help users find questions by using ElasticSearch. You'll discover ways to apply the principles of 12 factor apps while deploying Django on the most popular web server, Apache, with mod_wsgi. Lastly, you'll build a clone of MailChimp so users can send and create emails, and deploy it using AWS.
Get set to take your basic Django skills to the next level with this comprehensive guide!
▶What You Will Learn
- Build new projects from scratch using Django 2.0
- Provide full-text searching using ElasticSearch and Django 2.0
- Learn Django 2.0 security best practices and how they're applied
- Deploy a full Django 2.0 app almost anywhere with mod_wsgi
- Deploy a full Django 2.0 app to AWS's PaaS Elastic Beanstalk
- Deploy a full Django 2.0 app with Docker
- Deploy a full Django 2.0 app with NGINX and uWSGI
▶Key Features
- A beginners guide to learning python's most popular framework, Django
- Build fully featured web projects in Django 2.0 through examples.
- Deploy web applications in quick and reliable fashion with Docker
▶Who This Book Is For
This book is for developers who are familiar with Python. Readers should know how to run commands in Bash shell. Some basic HTML and CSS knowledge is assumed. Finally, the reader should be able to connect to a PostgreSQL database on their own.
▶What this book covers
- Chapter 1, Building MyMDB, covers starting a Django project and the core MyMDB Django app. You will create the core models, views, and templates. You will create URLConfs to help Django route requests to your views. By the end of this chapter, you will have a tested Django project that you can access using your web browser.
- Chapter 2, Adding Users to MyMDB, covers adding user registration and authentication. With users being able to register, log in, and log out, you will accept and display votes on movies. Finally, you'll write aggregate queries using Django's QuerySet API to score each movie.
- Chapter 3, Posters, Headshots, and Security, covers securely accepting and storing files from your users. You'll learn about the top web application security issues, as listed in the OWASP Top Ten, and how Django mitigates those issues.
- Chapter 4, Caching in on the Top 10, covers how to optimize Django projects. You'll learn how to measure what needs optimization. Finally, you'll learn about the different caching strategies Django makes available and when to use them.
- Chapter 5, Deploying with Docker, covers how to deploy Django using Nginx and uWSGI in a Docker container. You'll learn how to store uploaded files in S3 to protect the user. Finally, you'll run your Docker container on a Linux server in the Amazon Web Services cloud.
- Chapter 6, Starting Answerly, covers creating the models, views, templates, and apps for the Answerly project. You'll learn how to use Django's built-in date views to show a list of questions asked each day. You'll also learn how to split large templates into more manageable components.
- Chapter 7, Searching for Questions with Elasticsearch, covers working with Elasticsearch to let users search our questions. You will learn how to create a service that avoid coupling external services to your models or views. You will also learn how to automatically load and update model data in an external service.
- Chapter 8, Testing Answerly, covers how to test a Django project. You will learn how to measure code coverage in a Django project and how to easily generate test data. You will also learn how to write different types of tests from unit tests to live server tests with a working browser.
- Chapter 9, Deploying Answerly, covers how to deploy a Django project on a Linux server with Apache and mod_wsgi. You'll also learn how to treat your Django project like a twelve-factor app to keep it easy to scale.
- Chapter 10, Starting Mail Ape, covers creating the models, views, templates, and apps for the Mail Ape project. You'll learn how to use alternate fields for non-sequential primary keys.
- Chapter 11, Sending Emails, covers how to use Django's email functionality. You'll also learn how to use Celery to process tasks outside of the Django request/response cycle and how to test code that relies on Celery tasks.
- Chapter 12, Building an API, covers how to create an API using the Django REST Framework (DRF). You'll learn how DRF lets you quickly build an API from your Django models without repeating a lot of unnecessary code. You will also learn how to access and test your API.
- Chapter 13, Deploying Mail Ape, covers how to deploy a Django app into the Amazon Web Services cloud. You'll learn how to make an Amazon Machine Image (AMI) a part of a release. Then, you'll create a CloudFormation template to declare your infrastructure and servers as code. You’ll take a look at how to use AWS to horizontally scale your system to run multiple web workers. Finally, you'll bring it all online using the AWS command-line interface.