DEV Community

Cover image for Django & Docker - Open-source Projects
Sm0ke
Sm0ke

Posted on • Originally published at blog.appseed.us

Django & Docker - Open-source Projects

Hello Coders!

This article presents a curated list of Open-Source Django Projects already configured to run in Docker, the popular virtualization software. For newcomers, Django is a leading web framework coded in Python by programming experts and open-source enthusiasts using a batteries-included concept. All projects mentioned on this page are available for download from Github (no registration lock) under MIT License.

Thanks for reading! - Content provided by App Generator.


  • ๐Ÿ‘‰ Section #1: Django - Short Presentation
  • ๐Ÿ‘‰ Section #2: What is Docker
  • ๐Ÿ‘‰ Section #3: Install Docker (Unix workspace)
  • ๐Ÿ‘‰ Section #4: Docker CheatSheet
  • ๐Ÿ‘‰ Section #5: Pre-configured Docker Projects (all free)

1# - Django Presentation

Django is a modern web framework crafted in Python language that provides modules and libraries for many common features required in modern web development:

  • Basic authentication, Social Login
  • Out-of-the-box Admin Section with CRUD access for all tables
  • Abstract Database access via a powerful ORM
  • Powerful built-in security patterns
  • Helpers: forms, models, and data validation

Django can be installed in many ways and the most recommended way is to use PIP, the official Python package manager. Here is the complete list with commands:

Step #1 - Create a virtual environment

$ # Create the environment
$ virtualenv env 
$
$ # Activate the virtual environment
$ source env/bin/activate
Enter fullscreen mode Exit fullscreen mode

Step #2 - Install Django via PIP

$ pip install Django // install latest version
// OR
$ pip install django==3.2.6 // install specific version
Enter fullscreen mode Exit fullscreen mode

Step #3 - Build a minimal Django project

$ mkdir firstproject 
$ cd firstproject
$
$ django-admin startproject config . 
Enter fullscreen mode Exit fullscreen mode

Step #4 - Start the project

$ python manage.py runserver 
Enter fullscreen mode Exit fullscreen mode

If all goes well, we should see in the browser the default Django splash screen when accessing http://localhost:8000.

Django - The Default Screen


2# - What is Docker

Probably the best definition of Docker is the one provided by the official help: Docker is virtualization software for developing, shipping, and running applications that provides a clear separation of applications from the infrastructure so we can deliver software much faster and reliable.


Docker - Official Logo.


Basically, Docker provides a way to package applications into containers that are executable components built with applications source code and operating system libraries. Once the containers are built, Docker provides also a control layer that enables developers to build, deploy, start, stop, and update containers using simple commands. For more information about Docker feel free to access:


3# - Install Docker (Ubuntu 18 LTS)

All Django projects listed in the last section of this article can be compiled and executed without Docker by following the documentation provided for each project but using Docker the build and execution might be faster with fewer commands typed in the terminal. Let's install Docker using an Ubuntu 18 LTS workstation.


Note: All commands presented in this section are executed using sudo, a command that requires ROOT privileges.


Step #1 - Update the system to use the latest packages (optional but recommended)

$ sudo apt-get update
Enter fullscreen mode Exit fullscreen mode

Step #2 - Uninstall old versions of Docker (optional but recommended)

$ sudo apt-get remove docker-engine docker docker.io  
Enter fullscreen mode Exit fullscreen mode

Step #3 - Re-Install Docker (the latest version shipped by Ubuntu)

$ sudo apt-get install docker.io
Enter fullscreen mode Exit fullscreen mode

Step #4 - Enable Docker as a service

$ sudo systemctl enable docker
$ sudo systemctl start docker
Enter fullscreen mode Exit fullscreen mode

At this point, we should be able to build and start all Django samples using Docker. Just to check the installation we can check the version of the current Docker installation using --version argument:

$ docker --version 
Docker version 20.10.5, build 55c4c88 // <-- The Output 
Enter fullscreen mode Exit fullscreen mode

4# - Docker CheatSheet

This section is a short introduction to the most used Docker commands.

Docker - Inspecting Containers

$ docker --version       # check Docker version
$ docker ps -a           # list all containers
$ docker ps              # list all RUNNING containers
$ docker top <container> # list the active processes 
Enter fullscreen mode Exit fullscreen mode

Docker - Management Commands

$ docker run     <image>       # create and start the container
$ docker start   <container>   # start container
$ docker stop    <container>   # stop container (gracefully)
$ docker pause   <container>   # freeze the container
$ docker kill    <container>   # kill container (not gracefully)
$ docker restart <container>   # restart container (gracefully) 
Enter fullscreen mode Exit fullscreen mode

Docker - Image Transfer Commands

$ docker pull  <image>   # pull an image from a registry
$ docker push  <image>   # push/save an image to a registry
$ docker search <image>  # returns all images related to search keyword
Enter fullscreen mode Exit fullscreen mode

Docker - Miscellaneous Commands

$ docker container kill $(docker ps -q)  # kill all containers
$ docker container rm $(docker ps -a -q) # delete all containers 
$ docker network prune                   # delete all IPv4 used address 
Enter fullscreen mode Exit fullscreen mode

5# - Django & Docker Samples

With this minimal Django & Docker background we should be able to execute and understand how the samples are built and executed. Let's go!

Django Pixel Lite

Open-Source Django starter coded with basic modules, database, ORM, and deployment scripts on top of Pixel Lite UI Kit, a fully responsive and modern Bootstrap 5 UI Kit that will help you build creative and professional websites. The Django codebase is provided with database, ORM, authentication, and deployment scripts.


Django Pixel Lite - product page (contains sources and DEMO)


$ unzip django-pixel-lite.zip
$ cd django-pixel-lite
$
$ docker-compose pull 
$ docker-compose build 
$ docker-compose up
Enter fullscreen mode Exit fullscreen mode

Django Docker Sample - Pixel Lite.


Django Atlantis Dark

Atlantis Lite (Dark Design) is a free bootstrap 4 admin dashboard that is beautifully and elegantly designed to display various metrics, numbers, or data visualization. Atlantis Lite admin dashboard has 2 layouts, many plugins, and UI components to help developers create dashboards quickly and effectively so they can save development time and also help users to make the right and fast decisions based on existing data.


Django Atlantis Dark - product page (contains sources and DEMO)


$ unzip django-atlantis-dark.zip
$ cd django-atlantis-dark
$
$ docker-compose pull 
$ docker-compose build 
$ docker-compose up
Enter fullscreen mode Exit fullscreen mode

Django Docker Sample - Atlantis Dark.


Django Bootstrap 5 Volt

Volt Dashboard is a free and open-source Bootstrap 5 Admin Dashboard featuring over 100 components, 11 example pages, and 3 plugins with Vanilla JS. There is more than 100 free Bootstrap 5 components included some of them being buttons, alerts, modals, and datepickers.


Django Bootstrap 5 Volt - product page (contains sources and DEMO)


$ unzip django-dashboard-volt.zip
$ cd django-dashboard-volt
$
$ docker-compose pull 
$ docker-compose build 
$ docker-compose up
Enter fullscreen mode Exit fullscreen mode

Django Docker Sample - Volt Dashboard.


Django AdminLTE

AdminLTE is one of the best open-source admin dashboard & control panel themes. Built on top of Bootstrap, AdminLTE provides a range of responsive, reusable, and commonly used components. Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.


AdminLTE Django - product page (contains sources and DEMO)


$ unzip django-adminlte.zip
$ cd django-adminlte
$
$ docker-compose pull 
$ docker-compose build 
$ docker-compose up
Enter fullscreen mode Exit fullscreen mode

Django Docker Sample - AdminLTE Dashboard.


Thanks for reading! For more resources, please access:


Discussion (6)

Collapse
crearesite profile image
WebsiteMarket

The cheat sheet section is really useful.
Keep writing!

Collapse
sm0ke profile image
Sm0ke Author

Ty ๐Ÿš€๐Ÿš€

Collapse
rizalrazuwan_98 profile image
rizal-razuwan

Thankssss.................

Collapse
sm0ke profile image
Sm0ke Author

Yw!
๐Ÿš€๐Ÿš€

Collapse
uithemes profile image
ui-themes

Thank you!
I see the persistence is SQLite. If you have the time would be nice to enhance the Docker setup with a PostgreSQL deployment.

Collapse
sm0ke profile image
Sm0ke Author

Noted! ๐Ÿš€๐Ÿš€
I'll get back with this evolution in new article.