Django Code Examples

Django is a Python web framework.

Official Django logo. Trademark Django Software Foundation.

Django Example Projects

Part of Django's widespread adoption comes from its broad ecosystem of open source code libraries and example projects.

It's good to familiarize yourself with the following projects to learn what is available to you beyond the extensive "batteries-included" code base.

These projects, ordered alphabetically, are also helpful as example code for how to build your own applications.

AuditLog

Auditlog (project documentation) is a Django app that logs changes to Python objects, similar to the Django admin's logs but with more details and output formats. Auditlog's source code is provided as open source under the MIT license.

Example code found in the AuditLog project:

dccnsys

dccnsys is a conference registration system built with Django. The code is open source under the MIT license.

dccnsys is shown on the following code example pages:

django-allauth

django-allauth (project website) is a Django library for easily adding local and social authentication flows to Django projects. It is open source under the MIT License.

Code used for examples from the django-allauth project:

django-angular

django-angular (project examples website) is a library with helper code to make it easier to use Angular as the front-end to Django projects. The code for django-angular is open source under the MIT license.

Code from django-angular is shown on:

django-cors-headers

django-cors-headers is an open source library for enabling Cross-Origin Resource Sharing (CORS) handling in your Django web applications and appropriately dealing with HTTP headers for CORS requests.

Code examples from the django-cors-headers project:

django-cms

django-cms (project website) is a Python-based content management system (CMS) library for use with Django web apps that is open sourced under the BSD 3-Clause "New" License.

Example code from django-cms:

django-easy-timezones

django-easy-timezones (project website) is a Django middleware code library to simplify handling time data in your applications using users' geolocation data.

Useful example code found within django-easy-timezones:

django-filer

django-filer (project documentation) is a file management library for uploading and organizing files and images in Django's admin interface. The project's code is available under the BSD 3-Clause "New" or "Revised" open source license.

Code from django-filer can be found on these pages:

django-push-notifications

django-push-notifications is a Django app for storing and interacting with push notification services such as Google's Firebase Cloud Messaging and Apple Notifications. The django-push-notification project's source code is available open source under the MIT license.

django-jsonfield

django-jsonfield (jsonfield on PyPi) is a Django code library that makes it easier to store validated JSON in a Django object-relational mapper (ORM) database model.

The django-jsonfield project is open source under the MIT license.

django-oscar

django-oscar (project website) is a framework for building e-commerce sites on top of Django. The code for the project is available open source under a custom license written by Tangent Communications PLC.

Further code examples from django-oscar:

django-smithy

django-smithy is a Django code library that allows users to send HTTP requests from the Django admin user interface. The code for the project is open source under the MIT license.

Code examples from django-smithy are shown on the following pages:

drf-action-serializer

drf-action-serializer is an extension for Django REST Framework that makes it easier to configure specific serializers to use based on the client's request action. For example, a list view should have one serializer whereas the detail view would have a different serializer.

The project is open source under the MIT license.

There are code examples from the drf-action-serializer project on the following pages:

gadget-board

gadget-board is a Django, Django REST Framework (DRF) and Angular web application that is open source under the Apache2 license.

Additional example code found within gadget-board:

register

register is a Django, Bootstrap, PostgreSQL project that is open source under the GNU General Public License v3.0. This web application makes it easier for people to register as organ donors. You can see the application live at https://register.organize.org/.

Useful example code from register can be found on:

wagtail

wagtail (project website) is a fantastic Django-based CMS with code that is open source under the BSD 3-Clause "New" or "Revised" License.

Example code from wagtail shown on these pages:


Sign up for a monthly email with Full Stack Python tutorials. No spam ever.

Learn More Python

Introduction to Ansible video course logo.

Deploy web apps with the Ansible configuration management tool.

Full Stack Python

Full Stack Python is an open book that explains concepts in plain language and provides helpful resources for those topics.
Updates via newsletter, Twitter & Facebook.

Matt Makai 2012-2019