
Learn how to build and launch a web application with Django, a Python-based framework, exploring databases, sessions, security, and login features step by step.
Build a modern Django blog with CRUD views, authentication, image uploads, and admin management, learning function-based views, forms, URL routing, and template usage, all with open source code on GitHub.
Set up a Django 2.2 project using a virtual environment and Pipenv, start the project, migrate, and run the server across Windows, Linux, and Mac.
Discover how Django provides built-in authentication, an admin interface, and a robust ORM to map models to databases, while enabling secure, dynamic web pages through views.
Define a home page by creating your first Django view in views.py, returning an HttpResponse with HTML, illustrating Django's model-view-template pattern and the request–response flow.
Map your first Django url by updating urls.py to bind an empty string to the home page view, import the view, and test the new path on the running server.
Create and wire up multiple views for a Django app, adding about and contact pages, updating the URL configuration, and letting Django handle clean URL paths.
Learn how the Django 2.0+ path method uses a simple string for routing. Compare path with re_path and url patterns that rely on regular expressions.
Learn to set up a Django templates directory, create a hello world email template, and render it with render in a view, resolving the template does not exist error.
Diagnose a template not found error in Django by configuring templates with the base directory, verifying paths in the Python shell, and ensuring the template file exists.
Add bootstrap by importing the starter template, integrate container, row, and column divs, and enable dynamic titles to reflect different pages like home, about, and contact.
Learn how to render context in Django templates by passing a context dictionary and using double curly braces to substitute variables like title.
Learn to apply dry in django by creating a base template and using extends and blocks to avoid repetition and build reusable, consistent templates.
Explore rendering various template types with the Django template engine by using template names, contexts, and the get_template method to produce rendered strings and http responses.
Discover how Django’s template context processors automatically supply variables like user and request to templates, enabling authenticated status checks and dynamic rendering without extra context in every view.
Explore Django template tags to conditionally render data for authenticated users, loop through context lists, render variables, and use built-in filters, with logic split between templates and views.
Explore how Django turns static pages into dynamic data in a database, using apps as components like a blog app with a blog post model and its text field.
Learn how to define a blog post model, create instances with a title and content, and save and retrieve them from the database using Django's shell.
Register the blog post model with the Django admin to bring data into the admin interface. Import models, use the shell to query objects, and verify their id fields.
Demonstrates fetching a blog post by id in a Django view, passing the object in context to a blog post detail template, and rendering title and content from the database.
Implement dynamic url-based lookups in Django by passing an id through the url pattern to load blog posts. Compare integer converters with regex patterns and handle not found errors.
Raise http 404 for invalid dynamic urls and does not exist errors, and catch value errors to diagnose issues while aligning url data types with your Django views.
Learn how to robustly fetch objects with get_object_or_404 in Django, handling integer and string lookups, validating id fields, and avoiding page not found errors.
Learn how to replace numeric ID lookups with a slug-based lookup in Django, by adding a slug field, handling migrations and defaults, and updating views to query by slug.
Explore queryset lookups in Django by comparing get and filter, learn how to use a queryset, first and last methods, and handle slug conflicts to avoid not found errors.
Enforce unique slugs in Django to prevent duplicates and validation errors, migrate the database, and test locally to ensure the slug field is required and non-null.
Explain how web requests flow through Django and build crud views to create, retrieve, update, and delete blog posts using get and post methods.
Explore five crud-like views in Django, listing objects, detailing a single post, and preparing create, update, and delete interactions using templates and forms discussed for the blog.
Fetch all blog post objects with a Django queryset using the all() method and render them in a blog post list view template.
Set up and route Django blog views by creating, detailing, updating, and deleting blog posts, and mount URLs for create, edit, and delete endpoints.
Use modular apps and the include function to compose clean, non-redundant Django URLs, pulling in a blog URL module with a slug-based create view and top-to-bottom matching.
Learn how to organize Django templates by placing them in app-level templates directories, use the file system loader, and override app templates for easier customization.
Learn to implement a contact page form in Django using a raw HTML form, set method post, and CSRF token, then inspect request.POST data before migrating to Django forms.
Create a Django contact form by defining a forms class with full name, email, and content fields (text area), render it in a template, and validate input with Django forms.
Learn to save blog posts by creating a Django form with title, slug, and content, validating it, and saving data to a blog post model using cleaned_data or dictionary unpacking.
Discover how Django model forms use a blog post model to create fields like title, slug, and content, and save or customize data with form.save and commit=False.
Build custom form and model validations in Django 2.2 by implementing clean_<field> methods, using forms.ValidationError, enforcing unique titles, and applying icontains and iexact lookups.
Learn to protect Django views using the login_required and staff_member_required decorators, configure login URLs, and associate blog posts with specific users for secure, role-based access.
Associate a blog post with a user by declaring a foreign key to the user model, using settings, on delete set null, and reverse lookups via blog_post_set.
Link blog posts to the logged-in user with a foreign key and request.user, aided by decorators, then test authentication to ensure only authenticated users can create posts.
Update a blog post using a Django model form by passing an instance, rendering form.html with the context, validating input, and saving changes to the object.
Improve validation on update views by excluding the instance from uniqueness checks. Learn to inspect the form instance and apply queries to keep updates error-free on title, slug, and content.
Implement a safe delete workflow in Django 2.2 using a post request to delete objects, show a confirmation page with a CSRF token, and redirect afterward while requiring staff access.
Learn how to add clickable links in list views using anchor tags and get_absolute_url in Django, using slug lookups, and enable edit and delete options for staff in detail views.
Copy a bootstrap nav bar into a reusable template, then include it across pages to reuse the navigation; edit links for home and blog and refine the active state.
Explore how to use Django's include tag with arguments to create reusable inline templates for blog lists, passed objects, and consistent card layouts across pages.
Learn to implement a reusable included template for consistent blog list and detail views in Django, with optional truncation, line breaks, and view links for a cohesive site.
Explore how to add publish date, timestamp, and updated fields in Django models, use auto now, migrate, and order posts by publish date, updated, and timestamp for clearer listings.
Leverage a Django model manager and a custom query set to filter posts by publish date, showing only those published, and reuse this logic across views.
Publish and manage blog posts in Django 2.2 using a published date field and forms, then filter to show drafts and published posts by the author.
Configure Django to upload media and serve static files by setting up static and media routes, defining an image field, and testing uploads locally before deployment.
Install pillow to enable the image field and validate uploaded images, then run migrations. Use multipart/form-data and request.FILES to upload images and display them with bootstrap and django storage.
Try Django 2.2 is the latest in a line of Try Django series. This one covers the latest version of Django by building a blog application.
Python is one of the best programming languages in the planet. Why? For a few reasons:
It's proven & scalable
It's open-source
The Internet of Things and Raspberry Pi
It's leading the change for future technology
Proven & Scalable: Python runs Instagram's backend. It also run's Pinterest's, NASA, Mozilla, and countless others. It scales.
Open-Source: Open source technology means **anyone** can change it. Literally anyone. Are you in New Zealand? Yup you can change the code. Are you in Argentina? Yup, go ahead change it. Open-source changes the game for everyone because we can all use it.
Internet of Things (IoT) and Raspberry PI Connected devices are coming in waves. The easiest way to connect to these devices is using the Raspberry Pi and writing code in Python. Python is versatile so it makes controlling real-world objects with Raspberry Pi simple.
Pushing the Bounds of Future Technology Python is leading the charge in artificial intelligence with things like OpenCV, TensorFlow, PyBrain, and many others.
Sooo... Python is cool but why is this called Try Django? What's Django?
***
Django will be the backbone for your projects.
***
If you work with Python, the chances are good you need internet-connected data that stored securely and is reliable. This is where Django comes in. Django is a web-framework that can handle all of your data and handle it better than any web framework out there.
Django is the #1 Web Framework for Python for a reason: it's easy enough for the beginners and yet powerful enough for the pros. Instagram uses Python by way of Django. So does Pinterest. And Nasa. And Mozilla. It may not be the only technology that they use but its... the backbone of them all.
If Python is the future behind underlying technology, Django will be it's close cousin and if you love Python, Django will soon become your friend.
Cheers!
Justin