{"id":26939234,"url":"https://github.com/polunlin/docker-with-django-example","last_synced_at":"2026-05-05T19:33:17.287Z","repository":{"id":133447419,"uuid":"485651040","full_name":"PolunLin/Docker-with-Django-example","owner":"PolunLin","description":"This repo is for practicing run django service with PostgreSQL in docker container","archived":false,"fork":false,"pushed_at":"2022-04-26T06:08:03.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-20T10:26:54.548Z","etag":null,"topics":["django","docker","docker-compose","python"],"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/PolunLin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-04-26T05:51:03.000Z","updated_at":"2022-07-21T08:38:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"5eb696cb-ae91-47a2-88f6-04926c6f5bdf","html_url":"https://github.com/PolunLin/Docker-with-Django-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PolunLin/Docker-with-Django-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolunLin%2FDocker-with-Django-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolunLin%2FDocker-with-Django-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolunLin%2FDocker-with-Django-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolunLin%2FDocker-with-Django-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PolunLin","download_url":"https://codeload.github.com/PolunLin/Docker-with-Django-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PolunLin%2FDocker-with-Django-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32665009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["django","docker","docker-compose","python"],"created_at":"2025-04-02T14:17:03.288Z","updated_at":"2026-05-05T19:33:17.282Z","avatar_url":"https://github.com/PolunLin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker with Django example\n| This repo is for practicing run django service with PostgreSQL in docker container\n\n\n## Table of contents\n\n- [Docker with Django example](#docker-with-django-example)\n  - [Table of contents](#table-of-contents)\n  - [How to Create](#how-to-create)\n    - [1. Create a docker file](#1-create-a-docker-file)\n    - [2. Create requirements.txt file](#2-create-requirementstxt-file)\n    - [3. create docker-compose.yml](#3-create-docker-composeyml)\n  - [Run the application](#run-the-application)\n  - [Set DB connection information](#set-db-connection-information)\n  - [Run docker-compose up](#run-docker-compose-up)\n  - [Reference](#reference)\n## How to Create\n\n### 1. Create a docker file \n\n```bash\nFROM python:3\nENV PYTHONUNBUFFERED 1\nRUN mkdir /code\nWORKDIR /code\nCOPY requirements.txt /code/\nRUN pip install -r requirements.txt\nCOPY . /code/\n```\n\n### 2. Create requirements.txt file\n\n```bash\nDjango\u003e=2.0,\u003c3.0\npsycopg2\u003e=2.7,\u003c3.0\n```\n\n### 3. create docker-compose.yml\n\n```bash\nversion: \"3\"\nservices:\n\n  db:\n    image: postgres\n    environment:\n      POSTGRES_PASSWORD: 'postgres'\n\n  web:\n    build: .\n    command: python manage.py runserver 0.0.0.0:8000\n    volumes:\n      - .:/code\n    ports:\n      - \"8000:8000\"\n```\n\n## Run the application\n\n```bash\ndocker-compose run web django-admin startproject django_example .\n```\nAnd we will create \n\n\n```\n    Django with docker\n    │  docker-compose.yml\n    │  Dockerfile\n    │  manage.py\n    │  READ.md\n    │  requirements.txt\n    │\n    └─django_example\n        │  settings.py\n        │  urls.py\n        │  wsgi.py\n        │  __init__.py\n```\nIf your OS is linux, modify the file permission\n\n```\n$ sudo chown -R $USER:$USER .\n```\n\n## Set DB connection information\n\n```bash\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.postgresql',\n        'NAME': 'postgres',\n        'USER': 'postgres',\n        'HOST': 'db',\n        'PORT': 5432,\n        'PASSWORD': 'postgres',\n    }\n}\n```\n## Run docker-compose up\n```bash\ndocker-compose up\n## docker-compose run web python manage.py syncdb\n```\n\n## Reference\n\n  https://yeasy.gitbook.io/docker_practice/compose/django","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolunlin%2Fdocker-with-django-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolunlin%2Fdocker-with-django-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolunlin%2Fdocker-with-django-example/lists"}