Book Image

Building Django 2.0 Web Applications

By : Tom Aratyn
Book Image

Building Django 2.0 Web Applications

By: Tom Aratyn

Overview of this book

<p>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). </p><p> </p><p>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. </p><p> </p><p>Get set to take your basic Python skills to the next level with this comprehensive guide! </p><p></p>
Table of Contents (19 chapters)
Title Page
www.packtpub.com
Contributors
Preface
Index

Creating the user app


In this section, you will create a new Django app, called user, register it with your project, and make it manage users.

At the beginning of Chapter 1, Building MyMDB, you learned that a Django project is made up of many Django apps (such as our existing core app). A Django app should provide well-defined and tightly scoped behavior. Adding user management to our core app violates that principle. Making a Django app bear too many responsibilities makes it harder to test and harder to reuse. For example, we’ll be reusing the code we write in this user Django app throughout this book.

Creating a new Django app

As we did when we created the core app, we will use manage.py to generate our user app:

$ cd django
$ python manage.py startapp user
$ cd user
$ ls
__init__.py     admin.py        apps.py         migrations      models.py       tests.py        views.py

Next, we'll register it with our Django project by editing our django/config/settings.py file and updating the INSTALLED_APPS...