
Push a Django app to Heroku for professional web hosting, using the free tier with scalable dynos and a database, while building an address book app to learn deployment.
Install Python by uninstalling and reinstalling on Windows, ensure the add Python 3.7 to path checkbox is checked, download the latest version (32-bit), and note Mac and Linux guidance.
Install Git Bash on Windows to have a functional terminal for git and pushing to Heroku. Download from git-scm; add to path; enable unix tools and ssh keys.
Use git bash on windows to generate an ssh key in the .ssh directory with ssh-keygen, then copy the public key to GitHub and Heroku to enable pushing Django apps.
Install the Heroku toolbelt, download the installer, set the PATH, and restart the bash terminal to verify the Heroku version. The next video covers virtual environments and their importance.
Create and activate a virtual environment with pip to manage Python packages, test different Python versions, and prepare Django for deployment to Heroku.
Install Django in a virtual environment, install dependencies, start a new project, and run the local server to verify the setup for deployment on Heroku.
Django has updated to version 3.0 since this course was released. You can use the latest version of Django with no problems in this course.
Create a new Django app named address_book within the project, register it in installed apps, and wire its urls with include in the project urls to enable address book views.
Create your first web page in a Django app by setting up a templates folder, adding home.html, wiring a URL path to views.home, and rendering the page with hello world.
Create a base.html template using Django's template inheritance with block content and extends, then integrate bootstrap CSS to style pages and wrap content in a container with a nav bar.
Implement a bootstrap navbar in a Django app by copying a component, inserting it into the base file, and customizing links for a clean, dark navigation bar.
Add an address page to your Django app by creating the URL path, add_address view, and underscore address template. Update the base navigation to link home and add address.
Master git version control by configuring user name and email, initializing a repo, staging and committing files on the master branch, and preparing to push to GitHub and Heroku.
Sign up for a free Heroku account, review the free tier, and learn how dynos sleep and wake, then scale from 1 to higher plans as traffic grows.
Set up Heroku and push your code for the first time by logging in, adding SSH keys, and creating a new app, then prepare deployment in the next video.
Install gunicorn, django-heroku, and python-decouple to configure Heroku deployment, set the secret key, switch to Postgres, and enable static files handling with white noise.
Configure settings.py to use django-heroku and python-decouple, move the secret key to a hidden .env file, and set up dj-database-url for the Heroku postgres database.
Learn how to configure whitenoise for Django apps by setting static files directories, adding whitenoise middleware, and enabling static files storage for efficient web hosting.
Create a procfile and a requirements.txt to configure a django app for heroku. Use gunicorn as the web server and run pip freeze to capture dependencies for the requirements.txt.
practice migrating the Django admin database, create a superuser, and verify admin access by running the server; prepare to push the app to Heroku in the next step.
Push your code to Heroku for the first time, expect initial errors, and verify the automatically created Heroku Postgres database and config vars, including the secret key and database credentials.
Restart the Heroku dyno to fix downtime, run makemigrations and migrate on Heroku, and create a super user to access the admin after migrating the Postgres database.
Migrate from sqlite database to postgres on Heroku, update Django settings with the Heroku postgres URL, and connect local development to the cloud database. Test admin and verify data sync.
Build a Django address model with fields for name, email, phone, city, state, and zip, register it in admin, run migrations, and push to Heroku.
Import the address model in Django views, build a context with all addresses, and loop to display each record's name, email, phone, city, state, and zip on the home page.
Enhance a Django app's front end by styling Bootstrap cards, removing images, applying container and row structure, adjusting button styles, and preparing an address entry screen.
Create a django model form for the address model, listing fields like name, email, phone, address, city, state, and zip code, and enable messages for add and delete actions.
Add an address form using Bootstrap, switch to post, include a CSRF token, and customize fields for name, email, phone, address, city, state, and zip code.
Update views.py to handle the address form: process post data, validate and save to the address model, and redirect to home, with bootstrap alerts for success or error messages.
Create an edit page (edit.html) extending the base template, define an edit URL with the list_id, and pass the record id through the view to update a database record.
Edit address part 2 demonstrates fetching a single address by primary key, pre-filling the form with its values, validating, saving, and redirecting after edit.
Create a delete path and view to remove an address by id, post form data, and redirect home with a deletion message, plus a safeguard against direct url access.
Learn how to push your code to GitHub using an SSH key, create a new repository, commit changes, and push to Heroku master for Django apps.
Add a custom domain to your Heroku Django app by purchasing a domain from a registrar, then configure DNS to point to Heroku using the registrar's advanced DNS settings.
Highlight a lifetime membership offering Django and Python courses, with a three-day $200 discount, access to all courses, books, updates, certificates, and a 30-day money-back guarantee.
Do you know how to build Django apps with Python, but aren't sure how to get your app up onto the Internet? This course if for you!
In this course I'll teach you how to host your Django Python app on Heroku.
We'll build a cool address book app in Django 2 and Python 3. The main reason for this course, though, is to teach you how to get your Django apps off your computer and hosted live online.
So many instructors teach Django courses that don't show you how to make your app 'live' online. Why? Because it can be tricky! That's why I built a course that focuses just on that!
We'll learn how to:
Install Python
Install Django
Install and use Virtualenv
Install git Bash for Windows
Install the Heroku Toolbelt
Tweak a Django app's Setting to work with Heroku
Push our Code to Github and Heroku
Set up Postgres databases in the cloud
Build a cool little address book app
And much more...
I'll be walking you through this course on a Windows computer, but if you're on a Mac or Linux, you should be fine too. I try to point out any differences along the way.
If you've ever been confused by pushing code to a professional web hosting provider in Django, then this is the course for you.
See you on the inside!
-John Elder
CEO Codemy. com