{"id":17893895,"url":"https://github.com/mimischi/django-docker","last_synced_at":"2025-09-12T02:10:54.750Z","repository":{"id":24707022,"uuid":"102254647","full_name":"mimischi/django-docker","owner":"mimischi","description":"Toy project. Trying to use Django inside a Docker container for both local development and production deployment.","archived":false,"fork":false,"pushed_at":"2022-12-08T00:56:02.000Z","size":236,"stargazers_count":20,"open_issues_count":9,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T17:56:56.331Z","etag":null,"topics":["alpine","django","django-docker","docker","dokku","python3","sentry","travis-ci"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mimischi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-03T09:42:01.000Z","updated_at":"2024-06-09T15:45:18.000Z","dependencies_parsed_at":"2023-01-14T01:27:43.805Z","dependency_job_id":null,"html_url":"https://github.com/mimischi/django-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mimischi%2Fdjango-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mimischi%2Fdjango-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mimischi%2Fdjango-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mimischi%2Fdjango-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mimischi","download_url":"https://codeload.github.com/mimischi/django-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056889,"owners_count":20553855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpine","django","django-docker","docker","dokku","python3","sentry","travis-ci"],"created_at":"2024-10-28T14:58:01.838Z","updated_at":"2025-03-23T04:31:47.478Z","avatar_url":"https://github.com/mimischi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Develop and deploy Django applications with Docker\n\n[![Build Status](https://travis-ci.org/mimischi/django-docker.svg?branch=master)](https://travis-ci.org/mimischi/django-docker) [![codecov](https://codecov.io/gh/mimischi/django-docker/branch/master/graph/badge.svg)](https://codecov.io/gh/mimischi/django-docker) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\nThis repository is used to test a new project layout to develop Django\napplications within Docker containers. To be very fancy, we're also using\n`poetry.toml` instead of `requirements.txt` for our Python dependencies. Deployment\nto production is handled by a remote [Dokku](http://dokku.viewdocs.io/dokku/)\ninstance.\n\n## Details\n\nWe're using `Python 3.7-slim` for the base image as a trade-off of container size and build time.\n Further we utilize [`poetry`](https://github.com/python-poetry/poetry) to try out a new approach\n  of Python requirement management.\n\n## Features\n\n* Develop inside of Docker containers! (Both Django and PostgreSQL run inside of\n  their own containers)\n* Django `runserver_plus` is sequentially restarted, if the application crashes\n  for any reason.\n* Use `Makefile` for common commands (`docker-compose build`, `python manage.py\n  makemessages`, ...).\n* Uses [WhiteNoise](http://whitenoise.evans.io/en/stable/) to manage static\n  files.\n* Run continuous integration of Travis-CI.\n* Deploy to [Dokku](https://github.com/dokku/dokku) for production.\n* Use [Sentry](https://sentry.io/) for error reporting on your production\n  instance.\n  * **Psssst! You can easily run your own [Sentry instance on\n  Dokku](https://github.com/mimischi/dokku-sentry)!**\n\n**Note: In the current layout, with the `Dockerfile` residing under\n`./docker/dokku/Dockerfile`, you will need to install the\n[`dokku-dockerfile`](https://github.com/mimischi/dokku-dockerfile) plugin and\nset the path accordingly.****\n\n### Planned\n\n* It would be neat to get [Celery](http://www.celeryproject.org/) to work.\n\n# Usage\n\n## Local development\n\nRunning `make build` will download all required images (`python:3.7-slim` and\n`postgresql:9.6-alpine`) and build the app. Next you need to run `make migrate` to run\nall database migrations, after which you can actually start using this project.\nRunning `docker-compose up` will collect all staticfiles and start both\nservices. The app will be available via [localhost:8000](http://localhost:8000).\n\n## Deployment to production (via Dokku)\n\n### Prepare app on Dokku host\n\nBefore deployment, one needs to set up the app and PostgreSQL database on the\nDokku host. For the sake of simplicity we're going to name the Dokku app\n`djangodocker` in this example.\n\n```\n# Create app\n$ dokku apps:create djangodocker\n\n# Create PostgreSQL database and link it to the app\n$ dokku postgres:create djangodocker-postgres\n$ dokku postgres:link djangodocker-postgres djangodocker\n\n# Set the bare minimum configuration\n$ dokku config:set --no-restart djangodocker DJANGO_ADMIN_URL=\"/admin\"\n$ dokku config:set --no-restart djangodocker DJANGO_ALLOWED_HOSTS=djangodocker.example.com\n$ dokku config:set --no-restart djangodocker DJANGO_SECRET_KEY=$(echo `openssl rand -base64 100` | tr -d \\=+ | cut -c 1-64)\n$ dokku config:set --no-restart djangodocker DJANGO_SETTINGS_MODULE=config.settings.production\n$ dokku config:set --no-restart djangodocker DJANGO_SENTRY_DSN=https://your:sentry-dsn@sentry.com/1234\n# Make sure the plugin `dokku-dockerfile` is installed\n$ dokku dockerfile:set djangodocker docker/dokku/Dockerfile\n```\n\nYou may also need to set the domain using `dokku domains:set djangodocker\ndjangodocker.example.com`.\n\n### Setup Dokku server as `git remote`\n\nTo successfully push your app to the Dokku host, you need to set up the server\nas a `git remote`:\n\n`git remote add dokku dokku@djangodocker.example.com:djangodocker`\n\n### Deployment\n\nDeploying the `master` branch of the app is straightforward:\n\n`git push dokku master`\n\nIf you want to deploy another branch (e.g. `newfeature`), you need to use this\nsyntax:\n\n`git push dokku newfeature:master`\n\nMore information can be found in the [official Dokku\ndocumentation](http://dokku.viewdocs.io/dokku/getting-started/installation/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmimischi%2Fdjango-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmimischi%2Fdjango-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmimischi%2Fdjango-docker/lists"}