{"id":17865925,"url":"https://github.com/arocks/django-simple-asgi","last_synced_at":"2025-04-02T22:10:08.803Z","repository":{"id":137288429,"uuid":"233507417","full_name":"arocks/django-simple-asgi","owner":"arocks","description":null,"archived":false,"fork":false,"pushed_at":"2020-01-13T03:59:02.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T12:23:10.570Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/arocks.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-13T03:57:43.000Z","updated_at":"2020-01-13T03:59:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"1222a3c3-a52f-4ef7-afc5-8dcd7fc4b723","html_url":"https://github.com/arocks/django-simple-asgi","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/arocks%2Fdjango-simple-asgi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arocks%2Fdjango-simple-asgi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arocks%2Fdjango-simple-asgi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arocks%2Fdjango-simple-asgi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arocks","download_url":"https://codeload.github.com/arocks/django-simple-asgi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246899658,"owners_count":20851898,"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":[],"created_at":"2024-10-28T09:25:57.465Z","updated_at":"2025-04-02T22:10:08.772Z","avatar_url":"https://github.com/arocks.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\tDocker setup for Django Polls app + Postgres + Uvicorn + Gunicorn + Nginx\n\u003c/p\u003e\n\n***\n\nThis is a Django stack on Docker with focus on simplicity. The Django application sitting in the `djangoapp` directory is based on the official [Polls tutorial](https://docs.djangoproject.com/en/3.0/intro/tutorial01/). Since it is mounted into the container, code changes will be automatically applied. All the customizable configuration variables are in the `config` directory.\n\n## Quick Start\n\nIf you are in a hurry, just follow these steps:\n\n```bash\ncp config/django/example.env config/django/.env\ncp config/postgres/example.env config/postgres/.env\ndocker-compose up -d --build\ndocker-compose run djangoapp python manage.py migrate\ndocker-compose run djangoapp python manage.py collectstatic --no-input -v 2\n```\n\nWait for a few seconds for the services to be up and running. Then open the app at http://localhost\n\n## Common Tasks\n\n### Shutting Down\n\n``` bash\ndocker-compose down\n```\n\n### Load Initial Data\n\n```bash\ndocker-compose run djangoapp /bin/sh -c \"python manage.py flush; python manage.py migrate; python manage.py loaddata potter-fixture.json\"\ndocker-compose run djangoapp python manage.py createsuperuser\n```\n\n### View Error Logs\n\nIf running in the project directory `django-wsgi-simple` then it is usually:\n\n``` bash\ndocker logs django-wsgi-simple_nginx_1\ndocker logs django-wsgi-simple_djangoapp_1\n```\n\n## Cleanup\n\nRemove all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes.\n\n``` bash\ndocker system prune -f\ndocker system prune -f --volumes\n```\n\n## Production\n\nIn production, you might have to make many changes especially around security. It is recommended to create an application user as Docker containers will use the root user by default. The permissions can be restricted to that user. The docker image sizes can be reduced with multi-stage builds.\n\nRefer code from [testdriven.io](https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/), [rowdybeaver](https://github.com/rowdybeaver/sample-django-docker) and [Docker official docs](https://docs.docker.com/compose/production/) for details on the docker-compose production setup.\n\nNote: typically you would use a cloud-based database than run a database like Postgres in a docker container ([why?](https://vsupalov.com/database-in-docker/) but some people have no issues) in production. Even more, if you have a popular app then you will need something like Docker Swarm or Kubernetes rather than Docker Compose to scale up.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farocks%2Fdjango-simple-asgi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farocks%2Fdjango-simple-asgi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farocks%2Fdjango-simple-asgi/lists"}