
Build a basic flashcard website with Python and Django, handling math problems, generating flashcards, validating user answers, and deploying on Heroku's free tier.
Check out my student Facebook Group...
It's a great place to get fast support for this course from me, to interact with other students, to post your projects and code, and to access course announcements and extras...
Join Now!
https://www.facebook.com/groups/codemycom/
Download and install Python from python.org, select the 32-bit version, and add Python to your path so you can run it from anywhere; Mac guidance and next steps follow.
Run the Django development server to test your flashcard website, using manage.py and runserver, then view the default Django page at localhost:8000 to verify installation.
Learn how to migrate the Django database by applying 17 migrations, set up a super user, and access the admin area at /admin while running the local server.
Learn how to create a urls.py file in a Django project, include your app's routes, and connect the website's URLs to the main project for a functional flashcard site.
Set up a Django page by defining a view, configuring a URL, and creating a template to render a Hello world home page.
Learn to style web pages with Bootstrap, a popular CSS framework, using a starter template loaded from a CDN and integrated with Django.
Learn to template web pages by extracting the nav bar and footer into base.html using extends and block content, so updates apply across all pages.
Create four Django math pages (add, subtract, multiply, divide) by wiring templates, views, and URLs, and extend a base HDMI file to share a navigation bar across all pages.
Explore how Django links use the url tag to create dynamic, named URLs, replacing hardcoded hrefs and updating site navigation automatically across multiple pages.
Develop web forms for flashcards using bootstrap components, customizing inputs and buttons to answer questions like what's two plus two, with placeholders and layout tweaks.
Learn how to add a csrf token, set a form action to post back to itself, and name the input as 'answer' so Django can process submitted responses.
Handle form submissions in the add view by checking request.method for post, capturing request.POST['answer'], and rendering add.html with a context dictionary to display the submitted value.
Generate random integers 0–10 in Python with rand int to create math flashcards, pass numbers to the page via a context dictionary, and reload for new problems.
Pass random numbers from the front end back to the back end using hidden form fields, preserve old numbers, and set up comparing the user's answer to the correct result.
Determine correct answer teaches implementing a flashcard answer check by computing correct_answer, converting inputs to integers, and displaying both the user's answer and the correct result for verification.
Use bootstrap alert boxes in a Django flashcard app to show dismissible feedback after answering, with colors like danger, success, and info for correct or incorrect results.
Here are the flashcard image files in zip format. Feel free to download them, unzip them, and use them. :-)
Adapt the add page to create the subtract page, swap plus for minus, render subtract, and update the calculation to subtract old num1 minus old num2.
Create the multiply page by copying the subtract function, rendering a redirect to multiply, updating the correct and output answers, and adjusting the post action and symbols (x or ×).
Explore implementing division with a forward slash. Handle divide-by-zero gracefully and switch from integers to floats for valid, precise results.
Implement robust error handling in a Django flashcard app by validating form input, displaying warning messages, and redirecting when fields are empty to fetch new flashcards.
Learn how to set up a GitHub account, generate an SSH key, create a repository, and push your Django flash cards project with meaningful commits to GitHub for visibility and collaboration.
Learn how to host a Django app on Heroku, use the free tier, and push code from GitHub to deploy as your audience grows.
Install the Heroku toolbelt, verify with heroku --version, restart your git bash terminal to connect to Heroku from flashcards project, and ensure the master branch and an active virtual environment.
Install and configure gunicorn and supporting Django tools, create a Procfile, and update settings to deploy a Django app to Heroku using django-heroku and white noise.
Configure settings.py for Heroku by importing django_heroku and decouple, add white noise middleware and static files storage, reference django_heroku.settings, create a requirements text file, commit, and push to deploy.
Sign up for a free Heroku account, log in, create and rename an app, then push your code with git push heroku master to deploy the Django flashcards site.
Learn how to point a Heroku app to a custom domain by choosing a registrar like Namecheap, configuring a www DNS record, paying about $10 a year, and propagation times.
Promote a limited-time lifetime membership offering access to 60+ coding courses, including Python and Django, with discounts, PDF books, progress tracking, certificates, and member Q&A.
In this course we'll build a cool little website with Django and Python that will generate random math flashcards and allow the user to guess the answer. The app will then evaluate the answer and let the user know if they were correct or not.
It may seem like a simple app, but there are a lot of moving parts that will allow us to really learn some cool things with Django and Python!
You don't need to know Python, Django, or HTML to take this course, but if you already know any of those things, it'll be easier for you to follow along.
After we build the website, I'll show you how to set up Version control with Git, then we'll push our code to Github for safe keeping before pushing it to Heroku for Free Web hosting.
Python is easily the most popular programming language out there, and Django is the most popular Web Development Framework for Python. Learning it has never been easier!