{"id":25367975,"url":"https://github.com/imansadati/django_base_microservice","last_synced_at":"2026-04-10T07:05:43.730Z","repository":{"id":274313728,"uuid":"922523976","full_name":"imansadati/django_base_microservice","owner":"imansadati","description":"This repository is  demonstrates a Django microservices architecture (boilerplate) using Docker, Nginx, and PostgreSQL.","archived":false,"fork":false,"pushed_at":"2025-02-11T14:16:14.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-11T14:41:34.260Z","etag":null,"topics":["backend","django","docker","gunicorn","makefile","microservice","nginx","postgresql","python","shell"],"latest_commit_sha":null,"homepage":"","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/imansadati.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":"2025-01-26T12:58:27.000Z","updated_at":"2025-02-11T14:16:17.000Z","dependencies_parsed_at":"2025-02-11T20:30:31.074Z","dependency_job_id":null,"html_url":"https://github.com/imansadati/django_base_microservice","commit_stats":null,"previous_names":["imansadati/django_base_microservice"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imansadati%2Fdjango_base_microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imansadati%2Fdjango_base_microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imansadati%2Fdjango_base_microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imansadati%2Fdjango_base_microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imansadati","download_url":"https://codeload.github.com/imansadati/django_base_microservice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247987107,"owners_count":21028891,"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":["backend","django","docker","gunicorn","makefile","microservice","nginx","postgresql","python","shell"],"created_at":"2025-02-15T00:23:51.776Z","updated_at":"2026-04-10T07:05:43.686Z","avatar_url":"https://github.com/imansadati.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Microservices with Docker and Nginx\n\nThis repository demonstrates a Django microservices architecture using Docker, Nginx, and PostgreSQL. Each service is isolated, and the infrastructure is orchestrated with Docker Compose. Nginx acts as the reverse proxy to route traffic to respective services.\n\n\n## Features\n- **Dockerized Architecture**: Leverages Docker Compose for service orchestration.\n- **Microservices**: Separate Django applications for modular development.\n- **PostgreSQL**: A robust relational database.\n- **Nginx**: Acts as a reverse proxy and serves static/media files.\n- **Custom Django Base Image**: Utilizes a custom Django base image hosted on Docker Hub.\n- **Environment-Specific Boot Script**: Services adapt to either development or production mode based on environment variables.\n- **Makefile**: Simplifies common operations such as building, starting, and stopping services.\n\n## Prerequisites\n- **Docker** and **Docker Compose** installed.\n- if you want using **Makefile** make sure `make` package installed on your os. ([windows](https://stackoverflow.com/questions/32127524/how-to-install-and-use-make-in-windows), [Linux](https://askubuntu.com/questions/161104/how-do-i-install-make))\n- Access to the [custom Django base image](https://hub.docker.com/r/imansadatii/python-base). Ensure the image is pulled locally before building the services.\n\n\n## Services\nConsider these aliases (service_1, service_2) to make it easier to replace your own name. Be sure to replace these names with your own name wherever you see them.\n### Service 1\n\n- **Build Context**: `./services/service_1`\n- **Port**: 8001 on locally\n- **Dockerfile**:\n  with some specific settings and runs `check_postgres.sh` \u0026 `start.sh` script. \n\n### Service 2\n\n- **Build Context**: `./services/service_2`\n- **Port**: 8002 on locally\n- **Dockerfile**:\n  Similar to `service_1`, with its own app-specific logic.\n\n### Nginx\n\n- **Config**: Located at `./services/nginx/nginx.conf`\n- **Routes**:\n  - `/service_1/` -\u003e Service 1\n  - `/service_2/` -\u003e Service 2\n  - `/static/` and `/media/` -\u003e Static and media files\n\n\n## Custom Django Base Image\nThis project uses a custom Django base image available on Docker Hub. The image includes:\n- Python 3.12\n- Common dependencies for Django applications (e.g., `gunicorn`, `psycopg2`)\n- Optimized for both development and production use\n\nFor more details, visit the [Docker Hub page](https://hub.docker.com/r/imansadatii/python-base).\n\n\n## Environment Variables\n\n- Each service and the database require specific environment variables. Use `.env` files to manage them.\n- There are two environment: production \u0026 development.\n- Make sure visit core.urls.py after switching environments.\n\n### Example DJANGO_ENV in `.env`:\n```env\nDJANGO_ENV=developmnet or production\n```\n\n## Getting Started\n\n1. Clone this repository:\n   ```bash\n   git clone https://github.com/imansadatii/django_base_microservice.git\n   ```\n\n2. Build and start with Makefile:\n   ```bash\n   make build\n   ```\n3. Access the services via the following routes in **production** mode:\n   - **Service 1**: `http://localhost/service_1/`\n   - **Service 2**: `http://localhost/service_2/`\n\n4. Access the services via the following routes in **development** mode:\n   - **Service 1**: `http://localhost:8001/`\n   - **Service 2**: `http://localhost:8002/`\n\n\n## Running the Application\n\n### Using the Makefile\nThe `Makefile` provides convenient shortcuts for common tasks:\n\n- **Build services:**\n  ```bash\n  make build\n  ```\n- **Start services:**\n  ```bash\n  make run\n  ```\n- **Stop services:**\n  ```bash\n  make down\n  ```\n- **log specific service:**\n  ```bash\n  make log SERVICE=...\n  ```\n- **exec specific service:**\n  ```bash\n  make exec SERVICE=...\n  ```\n- **activate specific service venv:**\n  ```bash\n  make venv SERVICE=...\n  ```\n\nCustomize the `Makefile` as needed for additional commands.\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimansadati%2Fdjango_base_microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimansadati%2Fdjango_base_microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimansadati%2Fdjango_base_microservice/lists"}