{"id":28739847,"url":"https://github.com/codingforentrepreneurs/django-kubernetes","last_synced_at":"2025-08-02T11:32:53.167Z","repository":{"id":39861724,"uuid":"454851724","full_name":"codingforentrepreneurs/Django-Kubernetes","owner":"codingforentrepreneurs","description":"Learn how to deploy a docker-based Django application into a Kubernetes cluster into production on DigitalOcean.","archived":false,"fork":false,"pushed_at":"2022-05-24T10:26:43.000Z","size":48,"stargazers_count":164,"open_issues_count":2,"forks_count":135,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-07-30T22:32:06.970Z","etag":null,"topics":["digitalocean","digitalocean-kubernetes","django","doks","k8s","kubernetes"],"latest_commit_sha":null,"homepage":"https://www.codingforentrepreneurs.com/projects/django-kubernetes","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codingforentrepreneurs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-02T16:31:47.000Z","updated_at":"2025-07-24T00:59:47.000Z","dependencies_parsed_at":"2022-09-10T18:01:57.752Z","dependency_job_id":null,"html_url":"https://github.com/codingforentrepreneurs/Django-Kubernetes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codingforentrepreneurs/Django-Kubernetes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FDjango-Kubernetes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FDjango-Kubernetes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FDjango-Kubernetes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FDjango-Kubernetes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codingforentrepreneurs","download_url":"https://codeload.github.com/codingforentrepreneurs/Django-Kubernetes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FDjango-Kubernetes/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268378965,"owners_count":24240907,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["digitalocean","digitalocean-kubernetes","django","doks","k8s","kubernetes"],"created_at":"2025-06-16T06:11:01.826Z","updated_at":"2025-08-02T11:32:53.128Z","avatar_url":"https://github.com/codingforentrepreneurs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Django \u0026 Kubernetes Logo](https://static.codingforentrepreneurs.com/media/projects/django-kubernetes/images/share/Django__Kubernetes_Tutorial_Series.jpg)](https://www.codingforentrepreneurs.com/projects/django-kubernetes)\n# Django \u0026 Kubernetes\n\nLearn how to deploy a production-ready Django application into a Kubernetes cluster.\n\nKubernetes is a tool to manage containers. This type of management is called orchestration because it does more than just manage the containers such as it will scale up and scale down resources as needed (among many other things). \n\nSince Kubernetes is a massive tool, we're going to be covering a practical implementation using a Docker-based Django application.\n\nDjango is a way to build web applications rapidly using Python. There are many ways to get Django into production so the question is why use K8S at all? There's many reasons we'll cover throughout this series but here are a few:\n\n- Gracefully deploy Docker-based Django projects\n- Scale up (or scale down) your web apps with ease\n- Use a few or a lot of microservices internally or externally\n- Self-heal when services go down\n- Simplify app deployment (after initial configuration)\n- Streamline your backend Infrastructure (provision virtual machines and let k8s do the rest)\n\nKubernetes can do *a lot* which makes it a great tool to learn but also a daunting one at that. To make it more approachable here's what we'll be doing:\n\n- Start a Python Virtual Environment\n- Create a bare bones production-ready Django project \n- Create a Dockerfile to describe our environment (much like [this blog post](https://www.codingforentrepreneurs.com/blog/django-on-docker))\n- Use a managed Database service from DitgitalOcean\n- Install Kubernetes locally\n- Start a Kubernetes Cluster on DigitalOcean\n- Provision a Deployment and Service for our Django project\n- Implement Github Action Workflows to automate future deployments\n\n\n### References\n- [Django on Docker](https://www.codingforentrepreneurs.com/blog/django-on-docker) guide\n- [Docker \u0026 Docker Compose](https://www.codingforentrepreneurs.com/projects/docker-and-docker-compose) tutorial series\n- [Github Actions](https://www.codingforentrepreneurs.com/blog/django-github-actions) guide\n- [DigitalOcean $100 credit](https://do.co/cfe-sh) for new accounts\n- [Code](https://github.com/codingforentrepreneurs/Django-Kubernetes)\n\nWe have partnered with [DigitalOcean](https://do.co/cfe-sh) to bring you this series. Sign up for an [account](https://do.co/cfe-sh) when you're ready to get started with this series.\n\n\n\n## Cloning this Repo?\n\nMake sure you create `web/.env` and fill in the following variables:\n\n```\nDEBUG=1\nREGION=texas\nDJANGO_SUPERUSER_USERNAME=admin\nDJANGO_SUPERUSER_PASSWORD=mydjangopw\nDJANGO_SUERPUSER_EMAIL=hello@teamcfe.com\nDJANGO_SECRET_KEY=fix_this_later\n\nPOSTGRES_READY=0\nPOSTGRES_DB=dockerdc\nPOSTGRES_PASSWORD=mysecretpassword\nPOSTGRES_USER=myuser\nPOSTGRES_HOST=localhost\nPOSTGRES_PORT=5434\n\nREDIS_HOST=redis_db\nREDIS_PORT=6388\n```\n\u003e If you change `POSTGRES_PORT` or `REDIS_PORT` be sure to update those values in `docker-compose.yaml`\n\nOnce you have the above `.env` file, navigate to your project root (right where `docker-compose.yaml` is) and run:\n\n```\ndocker compose up -d\n```\nThis will create a `postgresql` database that's running in the background for you. To bring this database down just run:\n\n```\ndocker compose down\n```\nThe data in the database will be persistent so you can run `docker compose up -d` again with confidence. \n\n\nAlso in the root of your project:\n\n```\npython3.9 -m venv venv\nsource venv/bin/activate\npip install -r web/requirements.txt\n```\nThis will ensure your Django project is ready to be used locally.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingforentrepreneurs%2Fdjango-kubernetes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingforentrepreneurs%2Fdjango-kubernetes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingforentrepreneurs%2Fdjango-kubernetes/lists"}