{"id":19366659,"url":"https://github.com/cglusky/docker-django-react","last_synced_at":"2025-04-23T14:31:39.271Z","repository":{"id":39034770,"uuid":"280469551","full_name":"cglusky/docker-django-react","owner":"cglusky","description":"A local dev full-stack template using docker-compose with Django and React.","archived":false,"fork":false,"pushed_at":"2024-09-11T16:36:17.000Z","size":4922,"stargazers_count":42,"open_issues_count":0,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-12T02:02:27.350Z","etag":null,"topics":["django","django-rest-framework","docker","docker-compose","fullstack","react"],"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/cglusky.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-07-17T16:10:24.000Z","updated_at":"2024-09-11T16:36:16.000Z","dependencies_parsed_at":"2023-12-10T23:22:32.016Z","dependency_job_id":"b5624150-a719-45e5-818a-85e42781c091","html_url":"https://github.com/cglusky/docker-django-react","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/cglusky%2Fdocker-django-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cglusky%2Fdocker-django-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cglusky%2Fdocker-django-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cglusky%2Fdocker-django-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cglusky","download_url":"https://codeload.github.com/cglusky/docker-django-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250451791,"owners_count":21432899,"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":["django","django-rest-framework","docker","docker-compose","fullstack","react"],"created_at":"2024-11-10T07:46:11.020Z","updated_at":"2025-04-23T14:31:38.848Z","avatar_url":"https://github.com/cglusky.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-django-react\n\n## Project Status\n\n**Dec 2023**\nAlthough I do not use Django or React these days, I know someone who does.  Special thanks to @crhowell for helping me get this updated after three years of neglect.  Seems like a few people have found it useful, so we will try to give it a little more love.  Latest updates are mostly lessons learned, house keeping and version bumps.\n\n## Basics\n\nA slightly opinionated local dev full stack template using docker-compose with Django backend and React frontend; all served behind NGINX. Keeping the full stack in one repo for ease of use. Composed of ideas from multiple tutorials, forum threads and official docs. Nothing original here.\n\n## Main Frameworks/Libraries/Packages\n\nPlease see requirements.txt and package.json for full details.\n\nDjango\n\n- Django v5\n- Django Rest Framework\n- Django Rest Framework Simple JWT\n- PyTest\n\nReact\n\n- Create React App\n- Node dev server via Docker LTS alpine image\n- Hot reload\n\nPostgress\n\n- Docker v16.1 alpine image\n\nNgnix\n\n- Docker stable alpine\n- Serves Django's static and media files as well.  See conf for details.\n\n## Notes\n\nDjango\n\n- One app created/installed called core\n- Custom user stubbed out in the Core app. No additional fields. Just a blank class that inherets AbstractUser. core.User is assigned as AUTH_USER_MODEL\n- SimpleJWT is installed but not used.\n\n## Fork or Template\n\nFeel free to fork at will but it may be handier as template. The following are the steps I had in mind for using it as a project template:\n\n1. Create a new repo on GitHub without ReadMe\n2. On your local dev machine, and in your preferred parent directory:\n\n```sh\n\n$\u003e git clone https://github.com/cglusky/docker-django-react.git \u003cnew-local-repo-dir\u003e\n$\u003e cd \u003cnew-local-repo-dir\u003e\n$\u003e git remote set-url origin \u003curl-new-remote-repo-created-in-step-1\u003e\n$\u003e git push -u origin master\n\n```\n\n### Edit And Rename .env-example\n\nAll services expect to read env variables from .env.dev file. Please make sure you review the example and change the name to env.dev. AND that your gitignore handles env files before you commit super secret stuff to a public repo.\n\n### Useful Commands\n\nBuild containers. Add -up flag to bring services up after build.\n\n```sh\n\n$\u003e docker compose build\n\n```\n\nBring containers up. Add -d flag to run output detached from current shell.\n\n```sh\n\n$\u003e docker compose up\n\n```\n\nBring containers down. Add -v flag to also delete named volumes\n\n```sh\n\n$\u003e docker compose down\n\n```\n\nView logs by service name.\n\n```sh\n\n$\u003e docker compose logs \u003cservice-name\u003e\n\n```\n\nEnter shell for specified container (must be running)\n\n```sh\n\n$\u003e docker exec -it \u003ccontainer-name\u003e sh\n\n```\n\n### Containers, Services and Ports\n\n| Container  | Service | Host Port | Docker Port |\n| ---------- | ------- | --------- | ----------- |\n| dev-django | django  | 8001      | 8000        |\n| dev-react  | react   | 3001      | 3000        |\n| dev-db     | db      | 5432      | 5432        |\n| dev-nginx  | nginx   | 8080      | 80          |\n\n### Why NGINX for local dev?\n\nCross-Origin Resource Sharing(CORS) issues will make your browser sad when you serve your site from different ports as we do with this architecture. Using NGINX to proxy requests/responses to/from the correct container/service/ports helps make your browser happy. And it simulates real world infrastructure as a bonus. So...\n\nPlease make all requests from your browser through \u003chttp://localhost:8080\u003e and NGINX will happily redirect the request and proxy all your services so your browser thinks it's all one and the same protocol/domain/port == CORS bliss.\n\n### Can this be used for production?\n\nThis project is focused on making it easier to perform local full stack development.  However, it is possible to add new docker compose and docker files to also support production.  It's just out of scope for this project.  Please have a look in the archives folder for some old production docker files to give you an idea of what worked in the past.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcglusky%2Fdocker-django-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcglusky%2Fdocker-django-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcglusky%2Fdocker-django-react/lists"}