Log In
Or create an account -> 
Imperial Library
  • Home
  • About
  • News
  • Upload
  • Forum
  • Help
  • Login/SignUp

Index
Title Page Copyright and Credits
Building Django 2.0 Web Applications
www.packtpub.com
Why subscribe? PacktPub.com
Contributors
About the author About the reviewers Packt is searching for authors like you
Preface
Who this book is for What this book covers To get the most out of this book
Download the example code files Conventions used
Get in touch
Reviews
Starting MyMDB
Starting My Movie Database (MyMDB)
Starting the project
Installing Django Creating the project Configuring database settings
The core app
Making the core app Installing our app Adding our first model – Movie Migrating the database Creating our first movie Creating movie admin Creating MovieList view Adding our first template – movie_list.html Routing requests to our view with URLConf Running the development server
Individual movie pages
Creating the MovieDetail view Creating the movie_detail.html template Adding MovieDetail to core.urls.py A quick review of the section
Pagination and linking movie list to movie details
Updating MovieList.html to extend base.html Setting the order Adding pagination 404 – for when things go missing Testing our view and template
Adding Person and model relationships
Adding a model with relationships Different types of relationship fields
Director – ForeignKey Writers – ManyToManyField Role – ManyToManyField with a through class
Adding the migration Creating a PersonView and updating MovieList
Creating a custom manager – PersonManager Creating a PersonDetail view and template Creating MovieManager
A quick review of the section
Summary
Adding Users to MyMDB
Creating the user app
Creating a new Django app Creating a user registration view Creating the RegisterView template Adding a path to RegisterView Logging in and out
Updating user URLConf Creating a LoginView template A successful login redirect Creating a LogoutView template
A quick review of the section
Letting users vote on movies
Creating the Vote model Creating VoteForm Creating voting views
Adding VoteForm to MovieDetail Creating the CreateVote view Creating the UpdateVote view
Adding views to core/urls.py A quick review of the section
Calculating Movie score
Using MovieManager to calculate Movie score Updating MovieDetail and template
Summary
Posters, Headshots, and Security
Uploading files to our app
Configuring file upload settings Creating the MovieImage model Creating and using the MovieImageForm Updating movie_detail.html to show and upload images Writing the MovieImageUpload view Routing requests to views and files
OWASP Top 10
A1 injection A2 Broken Authentication and Session Management A3 Cross Site Scripting A4 insecure direct object references A5 Security misconfiguration A6 Sensitive data exposure A7 Missing function level access control A8 Cross Site Request Forgery (CSRF) A9 Using components with known vulnerabilities A10 Unvalidated redirects and forwards
Summary
Caching in on the Top 10
Creating a top 10 movies list
Creating MovieManager.top_movies() Creating the TopMovies view Creating the top_movies_list.html template Adding a path to TopMovies
Optimizing Django projects
Using the Django Debug Toolbar Using Logging Application Performance Management A quick review of the section
Using Django's cache API
Examining the trade-offs between Django cache backends
Examining Memcached trade-offs Examining dummy cache trade-offs Examining local memory cache trade-offs Examine file-based cache trade-offs Examining database cache trade-offs
Configuring a local memory cache Caching the movie list page
Creating our first mixin – CachePageVaryOnCookieMixin Using CachePageVaryOnCookieMixin with MovieList
Caching a template fragment with {% cache %} Using the cache API with objects
Summary
Deploying with Docker
Organizing configuration for production and development
Splitting requirements files Splitting settings file
Creating common_settings.py Creating dev_settings.py Creating production_settings.py
Creating the MyMDB Dockerfile
Starting our Dockerfile Installing packages in Dockerfile Collecting static files in Dockerfile Adding Nginx to Dockerfile
Configuring Nginx Creating Nginx runit service
Adding uWSGI to the Dockerfile Configuring uWSGI to run MyMDB
Creating the uWSGI runit service
Finishing our Dockerfile
Creating a database container Storing uploaded files on AWS S3
Signing up for AWS Setting up the AWS environment Creating the file upload bucket
Using Docker Compose
Tracing environment variables Running Docker Compose locally
Installing Docker Using Docker Compose
Sharing your container via a container registry Launching containers on a Linux server in the cloud
Starting the Docker EC2 VM Shutting down the Docker EC2 VM
Summary
Starting Answerly
Creating the Answerly Django project Creating the Answerly models
Creating the Question model Creating the Answer model Creating migrations
Adding a base template
Creating base.html
Configuring static files Letting users post questions
Ask question form Creating AskQuestionView Creating ask.html Installing and configuring Markdownify Installing and configuring Django Crispy Forms Routing requests to AskQuestionView A quick review of the section
Creating QuestionDetailView
Creating Answer forms
Creating AnswerForm Creating AnswerAcceptanceForm
Creating QuestionDetailView Creating question_detail.html
Creating the display_question.html common template Creating list_answers.html Creating the post_answer.html template
Routing requests to the QuestionDetail view
Creating the CreateAnswerView
Creating create_answer.html Routing requests to CreateAnswerView
Creating UpdateAnswerAcceptanceView Creating the daily questions page
Creating DailyQuestionList view Creating the daily question list template Routing requests to DailyQuestionLists
Getting today’s question list Creating the user app
Using Django's LoginView and LogoutView Creating RegisterView
Updating base.html navigation Running the development server Summary
Searching for Questions with Elasticsearch
Starting with Elasticsearch
Starting an Elasticsearch server with docker Configuring Answerly to use Elasticsearch Creating the Answerly index
Loading existing Questions into Elasticsearch
Creating the Elasticsearch service Creating a manage.py command
Creating a search view
Creating a search function Creating the SearchView Creating the search template Updating the base template
Adding Questions into Elasticsearch on save()
Upserting into Elasticsearch
Summary
Testing Answerly
Installing Coverage.py Measuring code coverage Creating a unit test for Question.save() Creating models for tests with Factory Boy
Creating a UserFactory Creating the QuestionFactory
Creating a unit test for a view Creating a view integration test Creating a live server integration test
Setting up Selenium Testing with a live Django server and Selenium
Summary
Deploying Answerly
Organizing configuration for production and development
Splitting our requirements file Splitting our settings file
Creating common_settings.py Creating dev_settings.py Creating production_settings.py
Preparing our server
Installing required packages Configuring Elasticsearch
Installing Elasticsearch Running Elasticsearch
Creating the database
Deploying Answerly with Apache
Creating the virtual host config Updating wsgi.py to set environment variables Creating the environment config file Migrating the database Collecting static files Enabling the Answerly virtual host A quick review of the section
Deploying Django projects as twelve-factor apps
Factor 1 – Code base Factor 2 – Dependencies Factor 3 – Config Factor 4 – Backing services Factor 5 – Build, release, and run Factor 6 – Processes Factor 7 – Port binding Factor 8 – Concurrency Factor 9 – Disposability Factor 10 – Dev/prod parity Factor 11 – Logs Factor 12 – Admin processes A quick review of the section 
Summary
Starting Mail Ape
Creating the Mail Ape project
Listing our Python dependencies Creating our Django project and apps Creating our app's URLConfs Installing our project's apps
Creating the mailinglist models
Creating the MailingList model Creating the Subscriber model Creating the Message model
Using database migrations
Configuring the database Creating database migrations Running database migrations
MailingList forms
Creating the Subscriber form Creating the Message Form Creating the MailingList form
Creating MailingList views and templates
Common resources
Creating a base template
Configuring Django Crispy Forms to use Bootstrap 4 Creating a mixin to check whether a user can use the mailing list Creating MailingList views and templates
Creating the MailingListListView view Creating the CreateMailingListView and template Creating the DeleteMailingListView view Creating MailingListDetailView
Creating Subscriber views and templates
Creating SubscribeToMailingListView and template Creating a thank you for subscribing view Creating a subscription confirmation view Creating UnsubscribeView
Creating Message Views
Creating CreateMessageView Creating the Message DetailView
Creating the user app
Creating the login template Creating the user registration view
Running Mail Ape locally Summary
The Task of Sending Emails
Creating common resources for emails
Creating the base HTML email template Creating EmailTemplateContext
Sending confirmation emails
Configuring email settings Creating the send email confirmation function Creating the HTML confirmation email template Creating the text confirmation email template Sending on new Subscriber creation A quick review of the section
Using Celery to send emails
Installing celery Configuring Celery settings Creating a task to send confirmation emails Sending emails to new subscribers Starting a Celery worker A quick review of the section
Sending messages to subscribers
Getting confirmed subscribers Creating the SubscriberMessage model Creating SubscriberMessages when a message is created Sending emails to subscribers
Testing code that uses Celery tasks
Using a TestCase mixin to patch tasks Using patch with factories Choosing between patching strategies
Summary
Building an API
Starting with the Django REST framework
Installing the Django REST framework Configuring the Django REST Framework
Creating the Django REST Framework Serializers API permissions Creating our API views
Creating MailingList API views
Listing MailingLists by API Editing a mailing list via an API
Creating a Subscriber API
Listing and Creating Subscribers API Updating subscribers via an API
Running our API Testing your API Summary
Deploying Mail Ape
Separating development and production
Separating our requirements files Creating common, development, and production settings
Creating an infrastructure stack in AWS
Accepting parameters in a CloudFormation template Listing resources in our infrastructure
Adding Security Groups Adding a Database Server Adding a Queue for Celery Creating a Role for Queue access
Outputting our resource information Executing our template to create our resources
Building an Amazon Machine Image with Packer
Installing Packer Creating a script to create our directory structure Creating a script to install all our packages Configuring Apache Configuring Celery Creating the environment configuration files Making a Packer template Running Packer to build an Amazon Machine Image
Deploying a scalable self-healing web app on AWS
Creating an SSH key pair Creating the web servers CloudFormation template
Accepting parameters in the web worker CloudFormation template Creating Resources in our web worker CloudFormation template Outputting resource names
Creating the Mail Ape 1.0 release stack SSHing into a Mail Ape EC2 Instance Creating and migrating our database Releasing Mail Ape 1.0
Scaling up and down with update-stack Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
  • ← Prev
  • Back
  • Next →
  • ← Prev
  • Back
  • Next →

Chief Librarian: Las Zenow <zenow@riseup.net>
Fork the source code from gitlab
.

This is a mirror of the Tor onion service:
http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion