Django & Docker - SQLite, MySql, and PostgreSQL samples
Tags: webdev, docker, django, opensource
Published: 2022-11-16 16:32:37

---
title: Django & Docker - SQLite, MySql, and PostgreSQL samples
published: true
description: Free samples that use different combinations between Django, Docker, and DB layer: SQLite, MySql, PostgreSQL.
tags: webdev, docker, django, opensource
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a0qm7rldz9znwct186q3.jpg
canonical_url: https://blog.appseed.us/django-docker-sqlite-mysql-postgresql-samples/
---
Hello coders!

This article mentions a few open-source [Django samples that bundle Docker](https://blog.appseed.us/django-docker-sqlite-mysql-postgresql-samples/) with different database engines: `SQLite`, `MySql`, and `PostgreSQL`. The projects might be useful to developers that what to switch from the minimal SQLite to a more powerful DB engine like PgSQL or MySql. Being released under the `MIT License`, the related **Docker** scripts can be copied and incorporated into other projects. 

> Thanks for reading!

---

## Django & Docker `SQLite`

This sample is the most simple one. The SQLite database is created by Django during the migration and does not require any additional Docker layer.

- 👉 [Django Material Kit](https://github.com/app-generator/django-material-kit) - `source code`
- 👉 [Django Material Kit](https://appseed.us/product/material-kit/django/) - `product page` (for support)

Once the product is downloaded, the app can be started via a single command:

```bash
$ docker-compose up --build 
```

During the execution, the Docker scripts prepare the environment, install the modules and migrate the database. In the end, the app should be up & running as this [LIVE Demo](https://django-material-kit.appseed-srv1.com/) of the product.

![Django Material Kit - Docker & SQLite set up.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xv19xge2332rrvxsiof7.png)

---

## [Django & Docker, MySql](https://github.com/app-generator/sample-docker-django-mysql)

Compared to the SQLite version, this sample requires a manual migration of the database.

- 👉 [Django & Docker, MySql](https://github.com/app-generator/sample-docker-django-mysql) Version - source code

Here is the full set up of the project.

> **Step 1** - Download the sources

```bash
$ git clone https://github.com/app-generator/sample-docker-django-mysql.git
$ cd sample-docker-django-mysql
```

---

> **Step 2** - Execute the Docker set up 

```bash
$ docker-compose up --build 
```

---

> **Step 3** - Migrate DB & create SuperUser

```bash
$ docker-compose run --rm appseed-app python manage.py migrate
$ docker-compose run --rm appseed-app python manage.py createsuperuser
```

> **Step 4** - Access the app in the browser

Visit `http://localhost:5085` in your browser. The app should be up & running. 

![Django, Docker & MySql - Free Sample.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ec2npo71ping1m8sz4v.png)

---

## [Django, Docker & PgSQL](https://github.com/app-generator/sample-docker-django-pgsql)

The last sample uses PostgreSQL for app persistence, a popular DB engine heavily used in production.

> 👉 [Django, Docker & PgSQL](https://github.com/app-generator/sample-docker-django-pgsql) - source code

The product can be started and used in a local environment by typing the same commands as for the MySql version:

- ✅ Download `source code`
- ✅ Execute `docker-compose up --build`
- ✅ `Migrate the database`
- ✅ `Create SuperUser` (optional)

![Django, Docker & PostgreSQL - Free Sample](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/whnwmzewcc4vh9h3xwjq.png)
 
---

All samples are built on top of Material Kit, an amazing design provided for free by [Creative-Tim](https://www.creative-tim.com/?AFFILIATE=128200). Here is the product description, copied from the official page:

> 👉 [Material Kit](https://www.creative-tim.com/product/material-kit?AFFILIATE=128200) - Open-Source Bootstrap 5 design

Designed for those who like bold elements and beautiful websites, Material Kit is ready to help you create stunning websites and web apps. The product is built on top of [Bootstrap 5](https://www.admin-dashboards.com/bootstrap-5-templates/) with over 60 frontend individual elements, like buttons, inputs, navbars, nav tabs, cards, or alerts, giving you the freedom of choosing and combining. 

![Material Kit - Free Bootstrap 5 Kit](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/509n3o8dob6jc5ci39cs.png)

---

> `Thanks for reading!` For more resources, please access:

- 🚀 Free [support](https://appseed.us/support/) provided by AppSeed (email & Discord)
- 👉 More [free apps](https://appseed.us/apps/open-source/) crafted in Flask, Django, and [React](https://appseed.us/apps/react/)