More on Django

Picture of the Full Stack Python Guide to Deployments book cover.Makai, M. (2015) The Full Stack Python Guide to Deployments

The Full Stack Python Guide to Deployments is a new book by Matt Makai originally released in July 2015 and most recently updated in December 2015 with detailed step-by-step tutorials for deploying Python web applications. There’s also a book bundle with a nicely formatted copy of the Full Stack Python website.

The content in The Full Stack Python Guide to Deployments is newly written just for this book. It works well either by itself or in combination with the material available on Full Stack Python.

What’s in the book?

Throughout the book you’ll take an example open source Python web application through a complete deployment on a virtual private server. In each chapter, we will first learn how to deploy the application manually, to fully understand each step, then automate the steps with Fabric and Ansible. We also set up a continuous integration server to automate the deployment process once we have our Ansible playbooks in place.

Chapters

  • Chapter 1: Introduction
  • Chapter 2: Servers (Linode)
  • Chapter 3: Operating Systems (Ubuntu)
  • Chapter 4: Web Servers (Nginx)
  • Chapter 5: Source control (Git)
  • Chapter 6: Databases (PostgreSQL and Redis)
  • Chapter 7: Application Dependencies
  • Chapter 8: WSGI Servers (Gunicorn)
  • Chapter 9: Task Queues (Celery)
  • Chapter 10: Continuous Integration (Jenkins)
  • Chapter 11: What’s Next?
  • Appendices: Technical Terms, Resources and App Code Tutorial

Here’s a visual preview of how we perform a full application deployment together throughout the book:


Full Stack Python logoFull Stack Python – Deployment
(http://www.fullstackpython.com/deployment.html)

Deployment involves packaging up your web application and putting it in a production environment that can run the app.

Why is deployment necessary?

Your web application must live somewhere other than your own desktop or laptop. A production environment is the canonical version of your current application and its associated data.

Deployment topics map

Python web application deployments are comprised of many pieces that need to be individually configured. Here is a map that visually depicts how each deployment topic relates to each other. Click the image to pull up a PDF version.

Full Stack Python site map.

Deployment hosting options

There are four options for deploying and hosting a web application:

  1. “Bare metal” servers
  2. Virtualized servers
  3. Infrastructure-as-a-service
  4. Platform-as-a-service

The first three options are similar. The deployer needs to provision one or more servers with a Linux distribution. System packages, a web server, WSGI server, database and the Python environment are then installed. Finally the application can be pulled from source and installed in the environment.

Note that there are other ways of installing a Python web application through system-specific package management systems. We won’t cover those in this guide as they are considered advanced deployment techniques.

Deployment resources

  • If you need a step-by-step guide to deploying a Python web application, I wrote a whole book on exactly this topic called The Full Stack Python Guide to Deployments that you’ll find super helpful.
  • Deploying Python web applications is an episode of the great Talk Python to Me podcast series where I discuss deploying web applications based on a fairly traditional virtual private server, Nginx and Green Unicorn stack.
  • Thoughts on web application deployment walks through stages of deployment with source control, planning, continuous deployment and monitoring the results.
  • Deploying Software is a long must-read for understanding how to deploy software properly.
  • Practical continuous deployment defines delivery versus deployment and walks through a continuous deployment workflow.
  • In this free video by Neal Ford, he talks about engineering practices for continuous delivery. He explains the difference between continuous integration, continuous deployment and continuous delivery. Highly recommended for an overview of deployment concepts and as an introduction to the other videos on those subjects in that series.
  • Continuous deployment at Instagram is the story of how their deployment process evolved over time from a large Fabric script to continous deployments. Along the way they encountered issues with code reviews, test failures, canary builds and rollbacks. It’s a great read that sheds some light on how Python deployments can be done well at large scale.
  • Stack Overflow’s guide on how they do deployment is an awesome in-depth read covering topics ranging from git branching to database migrations.
  • If you’re using Flask this detailed post on deploying it to Ubuntu is a great way to familiarize yourself with the deployment process.

Deployment learning checklist

  1. If you’re tight on time look at the platform-as-a-service (PaaS) options. You can deploy a low traffic project web app for free or low cost. You won’t have to worry about setting up the operating system and web server compared to going the traditional server route. In theory you should be able to get your application live on the web sooner with PaaS hosting.
  2. Traditional server options are your best bet for learning how the entire Python web stack works. You’ll often save money with a virtual private server instead of a platform-as-a-service as you scale up.
  3. Read about servers, operating systems, web servers and WSGI servers to get a broad picture of what components need to be set up to run a Python web application.

Back HomeLearn Django in 4 hours
(http://slash4.net/blog/learn-django-in-4-hours)

In this fast track tutorial you will create a fully blown event website using the python framework Django. On its homepage (http://djangoproject.com) it is described as: “The web framework for perfectionists with deadlines”. In “Learn Django in 4 hours” we will prove that this is very true.

We will get you started right away and let you create something awesome yourself !!!

After that course you will know the most important things about Django – what it can do, how it is used and you will have a feeling for how easy it is to get started. Of course it is not possible to cover all aspects of Django in 4 hours … this is not what we want and it is also not necessary to get you started on the fast lane.  … (Oliver Moser – Senior IT Conultant, Instructor)

This course is separated into 4 units – 1 hour each. You are free to do the whole tutorial at once or just 1 hour per week – just as you can organize it with your schedule.

With our courses you just need 1 hour per week and you will learn a new awesome technology every month. IT technology is fast paced – so should be your learning …

Never stop Learning!

Invest only 1 hour per week – and learn a new technology in just one month!

In this tutorial you are going to build an awesome event website – in just 4 hours. You will use an open source template to make it look professional.
You will do everything in the cloud – even your editor will be in the cloud. So you can start coding and creating your new project right away …

What will you need to learn Django?

  • You should have some basic understanding about Programming/Python, HTML, CSS and Linux to be able to follow the course.
  • Your complete learning environment will be in your browser
  • You will directly work in an online workspace to create an awesome web application
  • If you have never worked with Python, please have a look at: “best way to learn python” before
Chapter 1 – Introduction, Development Environment
1 Your first Django project
2 Create an Event Website using Django
3 Technologies that will be used in this course
4 Setup your Online Development Environment
5 Checkout Django workspace from github
6 Workspace Introduction – get familiar with your cloud environment
7 First Run of your Project
8 The Django Project Structure
9 Create your own Django Home Page
10 Create your first Django App
11 Excercises
Chapter 2 – Model and Admin
12 Django Model and Admin Site
13 Database Migration
14 Admin Site
15 Login to your Admin Site
16 Improve your Lists
17 Making changes to the Model
18 Adding search functionality
19 Django Model API
20 Excercises
Chapter 3 – Views, Templates and URLs
21 Views, Templates and URLs
22 Views and Templates
23 Static Files
24 Event Detail Page
25 … more on Templates
26 URL Configuration
27 Dynamic Home
28 Excercises
Chapter 4 – Authentication, Forms and more
29 Authentication and Forms
30 Login Page
31 Welcome User!
32 Logout
33 Who is attending an Event?
34 Revoke joining an Event
35 Who is going to an Event
36 Events that the logged in user is attending
37 Last but not least

Try Django 1.8 Tutorial – 1 of 42 – Introduction – Learn Django
(https://www.youtube.com/watch?v=KsLHt3D_jsE)

Published on 21 May 2015
System Setup: http://joincfe.com/projects/#setup
All our projects: http://joincfe.com/
Try Django 1.8 is a series to teach you the latest in Django Web Development by building a MVP Landing Page just like http://trydjango.com.
Topics include:
– Django Project Setup
– Models, Model Forms, Forms, Form Validation
– Function Based Views
– Integrate Bootstrap front-end framework.
– Django Registration Redux for Authentication/Registration
– Launch on a live server
– And More
Enjoy a free, ad-free, experience only for this series at: http://joincfe.com/projects/try-djang…
Premium, in-depth, Django tutorials available here: http://joincfe.com/projects.

What Technology you’ll learn in the Try Django 1.8 series:
— Django Framework (version 1.8): a powerful backend framework used by top sites like Instagram and Pinterest. Django makes it easier to have a powerful web application to use for all types of projects. Django is written in Python (and is one of the most popular Python libraries in the world). Read more here: http://djangoproject.com
— Bootstrap (version 3.3): a powerful front-end framework used by thousands of sites around the world. Bootstrap makes it easier to have a responsive web application so it looks awesome on any mobile device and any desktop computer.
— Python: One of the top programming languages in the world. Powerful enough for the experts, easy enough for beginners. Why? It uses spaces and line breaks with minimal special characters (like !@#$;*) which means it’s closer to English than most programming languages. Learn more: http://python.org


 Free UDEMY Course – A Beginners Guide to Django!
(https://www.udemy.com/introdjango/)

Learn all the basics of Django through a step-by-step process by creating your very own Polls Application for free!

Course Description

Have you ever wanted to create an app like Instagram? Maybe even Pinterest? Did you know that they were created through Django? I thought so 🙂

If you want to learn Django, you’re in the right place! We’ll cover everything there is in Django, from our directory and apps, to creating and populating our database. You’ll learn how to use URL’s, templates, and add CSS + Bootstrap to your app!

The best part? It’s absolutely free!

So what are you waiting for? Whip out your laptop, take a seat, and start developing Django today!

What are the requirements?

  • Basic knowledge of Python
  • Basic HTML/CSS (Not required)

What am I going to get from this course?

  • Create their own Django App
  • Create web applications on a highly powerful infrastructure
  • Create a responsive site through bootstrap
  • Setup applications and models in Django
  • Create custom URLs and Views
  • Leverage the use of templates
  • Add Static Files (CSS/JS)
Chapter 1 – Introduction, Development Environment
1 Your first Django project
2 Create an Event Website using Django
3 Technologies that will be used in this course
4 Setup your Online Development Environment
5 Checkout Django workspace from github
6 Workspace Introduction – get familiar with your cloud environment
7 First Run of your Project
8 The Django Project Structure
9 Create your own Django Home Page
10 Create your first Django App
11 Excercises
Chapter 2 – Model and Admin
12 Django Model and Admin Site
13 Database Migration
14 Admin Site
15 Login to your Admin Site
16 Improve your Lists
17 Making changes to the Model
18 Adding search functionality
19 Django Model API
20 Excercises
Chapter 3 – Views, Templates and URLs
21 Views, Templates and URLs
22 Views and Templates
23 Static Files
24 Event Detail Page
25 … more on Templates
26 URL Configuration
27 Dynamic Home
28 Excercises
Chapter 4 – Authentication, Forms and more
29 Authentication and Forms
30 Login Page
31 Welcome User!
32 Logout
33 Who is attending an Event?
34 Revoke joining an Event
35 Who is going to an Event
36 Events that the logged in user is attending
37 Last but not least

Ultimate Django -BECOME A DJANGO SUPERSTAR
(https://ultimatedjango.com/#full-package)

Learn everything you need to build awesome web apps with Django

The average salary for a Django developer in the US is over $100,000 per year. Experienced developers can earn much more. Organizations like Pinterest, Mozilla, and NASA rely on Django developers to power their mission critical applications. This is an in-demand skill that pays extremely well.

Django is also a great tool for entrepreneurs. Its origins trace back to a newsroom that needed to build stable, highly performant websites & applications on tight deadlines. This makes Django a great fit for startups who desire to build delightful customer experiences with limited resources. For example, Instagram was built with Django and within two years was acquired by Facebook for $1 billion. It’s no exaggeration to say that the framework is startup-ready.

Ready to get started? Ultimate Django is an online coding course packed with helpful resources that will take you from beginner to intermediate Django development within 6-8 weeks. You will acquire the skills needed to make your awesome ideas come to life. Or, if you want to start an exciting new career, you can use the course as your springboard.

Here’s an inventory of the skills you’ll acquire by completing the Ultimate Django Course

Creating Static Web Pages

Use the basics of Django to create static web pages for any need.

Building User Registration Forms

Web apps need users. Users need to register. Learn to build custom registration flows.

Processing Customer Payments

Keep your lights on. Learn how to charge user credit cards using Stripe.

Using Git and Github

Manage your software projects with Git. Collaborate on software projects using Github.

Hosting on Heroku

Speed up development by outsourcing ops and infrastructure management to Heroku.

Hosting Assets on a CDN

Keep your customers happy by making page loads snappy. Host static assets on a CDN.

Displaying lists of Data

Chances are high that you’ll need to list things in your app. Know how to do it quickly.

Searching through Data

Make life easier for your users by adding relevant search options.

Create, Update, List, Delete Data

All web developers must know how to build basic and advanced CRUD functionality.

AJAX for Better User Experience

Make web apps feel more like desktop apps by learning the art and science of AJAX.

Learn Django
(https://ultimatedjango.com/learn-django/chapters/)

Learn how to build awesome applications with the Django web framework.

Course Chapters

Course Intro
Welcome! This chapter will go over a few things to get you acclimated with the purpose and structure of the course.

  • Welcome
  • What is Django and Why Use It?
  • The Course Project
  • The Recommended Screen Layout
  • How the Course is Organized
Install Required Software
Several different software packages are required to complete the course. This chapter will help you set them up.
  • Chapter Intro
  • Install Python
  • Install PIP
  • Install Git
  • Install Virtualenv
  • Install an IDE
  • Ready Your CMD or Terminal

Your First Web App
We start our journey with humble beginnings. In this chapter you’ll learn how to build a simple application that renders Hello, World in your browser.

  • Chapter Intro
  • How Django Works
  • Install & Setup Django
  • Create the “Hello, World” Web App

Setup CRM Easy Project
In this chapter you move quickly into setting up Django for building the CRM Easy application. This includes configuring the database, setting environment variables, and changing a few Django settings.

  • Chapter Intro
  • Install & Setup Django
  • Install the Database
  • Configure the Database
  • Define Environments
  • Handling Sensitive Keys
  • Serving Static Files
  • Add Static Files
  • Checkpoint

Create the Home Page
The CRM Easy home page is an excellent point to start at because it uses several Django components to render a static HTML page. This chapter will introduce you to those components.

  • Chapter Intro
  • Understanding Apps
  • Create the Marketing App
  • Understanding Django Views
  • Create the Home Page View
  • Understanding Templates
  • Configure Template Settings
  • Create the Project Base Template
  • Create the Home Page Template
  • Understanding the URL Dispatcher
  • Create the URL Conf
  • Checkpoint

Deploy to Heroku
Web applications need a place to live, and Heroku is excellent an excellent home for them. Learn how to easily deploy apps to Heroku in this chapter.

  • Chapter Intro
  • Understanding Heroku
  • Ready Local Environment
  • Update Django Settings
  • Push to Heroku
  • Checkpoint

Create the Subscriber Form – Part I
This the first of three chapters that will show you how to build the CRM Easy app subscriber form. In this chapter you’ll learn how to setup a simple version of the form that can create users in the application.

  • Chapter Intro
  • Create the Subscribers App
  • Understanding Forms
  • Understanding the Auth System
  • Create the Subscriber Form
  • Create the Subscriber View
  • Create the Subscriber URL
  • Create the Subscriber Template
  • Update Base & Home Templates
  • Checkpoint

Create the Subscriber Form – Part II
In this chapter you’ll continue building the subscriber form. You’ll create your first model and update the subscriber form to collect billing information from customers.

  • Chapter Intro
  • Understanding Models
  • Create the Model
  • Understanding Classes
  • Update the Form
  • Update the View
  • Update the Template
  • Checkpoint

Create the Subscriber Form – Part III
In this last installment, you’ll learn how to use the Stripe payment service to add payment processing to the subscriber form.

  • Chapter Intro
  • Understanding Stripe
  • Install & Configure Stripe
  • Adding Business Logic to Models
  • Create Stripe Processing Code
  • Update the View
  • Update the Template
  • Checkpoint

Create the Login Page
Django has an excellent authentication system that makes it easy to build applications that allow users to create accounts. Here you’ll learn how to use it to build a login and logout feature.

  • Chapter Intro
  • Create the Login Template
  • Create the Login & Logout URLs
  • Update Base Template & Settings
  • Checkpoint

Create the Account List
The CRM Easy application lets users create customer accounts. In this chapter you’ll learn how to create a page that displays a paginated lists of accounts.

  • Chapter Intro
  • Account App Setup – Create App
  • Account App Setup – Create Model
  • List Accounts – Create URL
  • List Accounts – Create View
  • List Accounts – Create/Update Templates
  • List Accounts – Add Pagination
  • List Accounts – Add Search
  • Checkpoint

Create the Account Detail – Part I
The account detail page shows all information about an account, including its address, related contacts, and communications. This chapter is the first of two that will teach you how to display account records on a page.

  • Chapter Intro
  • View Account – Create URL
  • View Account – Create View
  • View Account – Create Templates
  • Checkpoint

Create the Account Detail – Part II
Continuing from the previous chapter, here you’ll learn how to build functionality that lets users create and edit account detail records.

  • Chapter Intro
  • New Account – Create Form
  • New Account – Create URL Conf
  • New Account – Create View
  • New Account – Create Templates
  • Checkpoint – New Account
  • Edit Account – Create URL Conf
  • Edit Account – Modify View
  • Edit Account – Create/Update Templates
  • New/Edit Contact – Enable AJAX
  • Checkpoint – Edit Account

Create the Contacts – Part I
Users will be able to create contacts and associate them with account records. In this chapter you’ll learn how to display contact records on the account detail page.

  • Chapter Intro
  • Contact App Setup – Create App
  • Contact App Setup – Create Model
  • View Contact – Create URL
  • View Contact – Create View
  • View Contact – Create Template
  • View Contact – Add to Account Detail
  • Checkpoint

Create the Contacts – Part II
The CRM Easy application design makes it possible for users to create, edit, & delete contacts straight from the account detail page. Here you’ll build the functionality that allows users to perform those three actions.

  • Chapter Intro
  • New Contact – Create Form
  • New Contact – Create URL
  • New Contact – Create View
  • New Contact – Create/Update Templates
  • Checkpoint – New Contact
  • Edit Contact – Create URL
  • Edit Contact – Modify View
  • Edit Contact – Create/Update Templates
  • New/Edit Contact – Enable AJAX
  • Delete Contact – Full Lesson
  • Checkpoint – Edit Contact

Create the Communications – Part I
Users of the CRM Easy application will be able to record key communications with their customers, such as phone calls or meetings. Here you’ll learn how to build the functionality that displays communications on the account detail page.

  • Chapter Intro
  • Comm App Setup – Create App
  • Comm App Setup – Create Model
  • View Comm – Create URL
  • View Comm – Create View
  • View Comm – Create Template
  • View Comm – Add to Account Detail
  • Checkpoint

Create the Communications – Part II
This chapter will walk you through building the create, update, delete actions for the communications feature.

  • Chapter Intro
  • New Comm – Create Form
  • New Comm – Create URL
  • New Comm – Create View
  • New Comm – Create/Update Templates
  • Checkpoint – New Comm
  • Edit Comm – Create URL
  • Edit Comm – Modify View
  • Edit Comm – Create/Update Templates
  • New/Edit Comm – Enable AJAX
  • Delete Comm – Full Lesson
  • Checkpoint – Edit & Delete

Deploying to Production
Now that you have the application built, this chapter will show you how to prepare it for a production deployment.

  • Chapter Intro
  • Compressing Static Assets
  • Creating Public Error Pages
  • Configure Error Logging & Reporting
  • Purchase & Configure SSL
  • Purchase & Configure Domain Name
  • Deploy to Production Instances

Starting a Django Project
(https://realpython.com/learn/start-django/)

 Answering the question, “How do I setup a Django (1.5, 1.6, 1.7, or 1.8) Project from scratch?”
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

  1. Read over the Introduction and Setup sections.
  2. Then choose your poison – Django 1.5, 1.6, 1.7, 1.8 – to setup a Django Project.
  3. After the initial Project setup, move down to the Create an App section to setup a nice and easy app.
  4. Then checkout the summary workflow for a quick-start guide to a Django Project.

Introduction

This tutorial answers the question, “How do I setup a Django Project from scratch?”. Since you’re reading this, I assume (err, hope) you know that Django is a Python web framework built for rapid web development. We’ll go through the setup, detailing the basic installation procedures of Django and the dependencies required as well as a few additional libraries/extensions to get you started developing ASAP.

We’ll also look at a basic workflow you can use as soon as your project structure is setup.

Finally, be sure to check out the following videos:

Although these videos are specific to Django 1.5, they’ll help you understand the basic workflow for Django 1.6, 1.7, and 1.8 as well.

Tutorial Requirements
You should have some Python experience and know basic Unix bash commands. If you’ve never used the command line before, please familiarize yourself with the following commands: pwd, cd, ls, rm, and mkdir.

For simplicity, all examples use the Unix-style prompt:

$ python manage.py runserver

(The dollar sign is not part of the command.)

Windows equivalent:

C:\> python manage.py runserver

SetupWhat you need for a basic dev environment:

  1. Python 2.7.x or 3.4.x
  2. easy_install and Pip
  3. Git
  4. virtualenv
  5. Django
  6. Database (SQLite, MySQL, PostgreSQL, MongoDB, etc.)
  7. South (for Django versions prior to 1.7)
  8. Text editor (Sublime, vim, Komodo, gedit)

Note: This tutorial utilizes Python version 2.7.8.