All Projects β†’ mimischi β†’ django-docker

mimischi / django-docker

Licence: other
Toy project. Trying to use Django inside a Docker container for both local development and production deployment.

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects
Makefile
30231 projects
shell
77523 projects
HTML
75241 projects

Projects that are alternatives of or similar to django-docker

dokku-sentry
Deploy your own instance of Sentry onto Dokku!
Stars: ✭ 64 (+255.56%)
Mutual labels:  sentry, dokku
2019-01
πŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»Boolean Avengers : 개발 상식을 점검할 수 μžˆλŠ” μ›Ή μ‹œλ¦¬μ–΄μŠ€ κ²Œμž„ μ„œλΉ„μŠ€
Stars: ✭ 38 (+111.11%)
Mutual labels:  travis-ci
Dockerfiles
These are Dockerfiles I've created for programs without official docker image.
Stars: ✭ 24 (+33.33%)
Mutual labels:  alpine
bymattlee-11ty-starter
A starter boilerplate powered by 11ty, Sanity, Gulp, Tailwind CSS, rollup.js, Alpine.js and Highway.
Stars: ✭ 27 (+50%)
Mutual labels:  alpine
docker-php-alpine
minimal (ish) php images in alpine
Stars: ✭ 29 (+61.11%)
Mutual labels:  alpine
xx
Dockerfile cross-compilation helpers
Stars: ✭ 124 (+588.89%)
Mutual labels:  alpine
docker-alpine
Minimal Alpine with working init process
Stars: ✭ 21 (+16.67%)
Mutual labels:  alpine
pypackage
Cookiecutter python package using Poetry, mypy, black, isort, autoflake, pytest, mkdocs, and GitHub Actions
Stars: ✭ 12 (-33.33%)
Mutual labels:  travis-ci
xen-orchestra-ce
🐳 Docker & docker-compose files to deploy Xen Orchestra Community Edition (ie: from sources)
Stars: ✭ 70 (+288.89%)
Mutual labels:  alpine
go-docker
Sample code and dockerfiles accompanying the blog post The Ultimate Guide to Writing Dockerfiles for Go Web-apps
Stars: ✭ 89 (+394.44%)
Mutual labels:  alpine
docker-serveo
https://serveo.net is an alternative for ngrok. taichunmin/serveo can let you secure URL to your localhost server through any NAT or firewall in Docker. And taichunmin/serveo-server can let you host your own serveo.
Stars: ✭ 91 (+405.56%)
Mutual labels:  alpine
badge-matrix
More advanced badges for projects using Travis or Sauce Labs
Stars: ✭ 77 (+327.78%)
Mutual labels:  travis-ci
sentry-mattermost
Sends Sentry notifications to Mattermost Open Source Chat
Stars: ✭ 30 (+66.67%)
Mutual labels:  sentry
ci-docker-image
A Docker Image meant for use with CI/CD pipelines
Stars: ✭ 23 (+27.78%)
Mutual labels:  dokku
alpine
🌍 `alpine` Docker image for multiple architectures
Stars: ✭ 81 (+350%)
Mutual labels:  alpine
incubator-sentry
Mirror of Apache Sentry
Stars: ✭ 35 (+94.44%)
Mutual labels:  sentry
mariadb
MariaDB docker container image
Stars: ✭ 42 (+133.33%)
Mutual labels:  alpine
CPP Template
C++ project template : CMake, Test, Travis CI, Appveyor, CodeCoverage, Doxygen
Stars: ✭ 32 (+77.78%)
Mutual labels:  travis-ci
django-github-digitalocean
Continuously Deploying Django to DigitalOcean with Docker and GitHub Actions
Stars: ✭ 45 (+150%)
Mutual labels:  django-docker
alpine-php-fpm
Lightweight and optimised PHP-FPM (PHP 7.4, 8.0, 8.1) Docker images with essential extensions on top of latest Alpine Linux.
Stars: ✭ 53 (+194.44%)
Mutual labels:  alpine

Develop and deploy Django applications with Docker

Build Status codecov PRs Welcome

This repository is used to test a new project layout to develop Django applications within Docker containers. To be very fancy, we're also using poetry.toml instead of requirements.txt for our Python dependencies. Deployment to production is handled by a remote Dokku instance.

Details

We're using Python 3.7-slim for the base image as a trade-off of container size and build time. Further we utilize poetry to try out a new approach of Python requirement management.

Features

  • Develop inside of Docker containers! (Both Django and PostgreSQL run inside of their own containers)
  • Django runserver_plus is sequentially restarted, if the application crashes for any reason.
  • Use Makefile for common commands (docker-compose build, python manage.py makemessages, ...).
  • Uses WhiteNoise to manage static files.
  • Run continuous integration of Travis-CI.
  • Deploy to Dokku for production.
  • Use Sentry for error reporting on your production instance.

Note: In the current layout, with the Dockerfile residing under ./docker/dokku/Dockerfile, you will need to install the dokku-dockerfile plugin and set the path accordingly.**

Planned

  • It would be neat to get Celery to work.

Usage

Local development

Running make build will download all required images (python:3.7-slim and postgresql:9.6-alpine) and build the app. Next you need to run make migrate to run all database migrations, after which you can actually start using this project. Running docker-compose up will collect all staticfiles and start both services. The app will be available via localhost:8000.

Deployment to production (via Dokku)

Prepare app on Dokku host

Before deployment, one needs to set up the app and PostgreSQL database on the Dokku host. For the sake of simplicity we're going to name the Dokku app djangodocker in this example.

# Create app
$ dokku apps:create djangodocker

# Create PostgreSQL database and link it to the app
$ dokku postgres:create djangodocker-postgres
$ dokku postgres:link djangodocker-postgres djangodocker

# Set the bare minimum configuration
$ dokku config:set --no-restart djangodocker DJANGO_ADMIN_URL="/admin"
$ dokku config:set --no-restart djangodocker DJANGO_ALLOWED_HOSTS=djangodocker.example.com
$ dokku config:set --no-restart djangodocker DJANGO_SECRET_KEY=$(echo `openssl rand -base64 100` | tr -d \=+ | cut -c 1-64)
$ dokku config:set --no-restart djangodocker DJANGO_SETTINGS_MODULE=config.settings.production
$ dokku config:set --no-restart djangodocker DJANGO_SENTRY_DSN=https://your:[email protected]/1234
# Make sure the plugin `dokku-dockerfile` is installed
$ dokku dockerfile:set djangodocker docker/dokku/Dockerfile

You may also need to set the domain using dokku domains:set djangodocker djangodocker.example.com.

Setup Dokku server as git remote

To successfully push your app to the Dokku host, you need to set up the server as a git remote:

git remote add dokku [email protected]:djangodocker

Deployment

Deploying the master branch of the app is straightforward:

git push dokku master

If you want to deploy another branch (e.g. newfeature), you need to use this syntax:

git push dokku newfeature:master

More information can be found in the official Dokku documentation.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].