{"id":13416261,"url":"https://github.com/bfirsh/django-docker-heroku-template","last_synced_at":"2025-04-23T03:26:34.346Z","repository":{"id":42901048,"uuid":"252298288","full_name":"bfirsh/django-docker-heroku-template","owner":"bfirsh","description":"Get a Django app up and running in dev, test, and production with best practices in 10 minutes","archived":false,"fork":false,"pushed_at":"2022-03-26T10:44:04.000Z","size":1278,"stargazers_count":36,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-21T13:04:54.811Z","etag":null,"topics":[],"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/bfirsh.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}},"created_at":"2020-04-01T22:14:05.000Z","updated_at":"2024-05-11T19:57:32.000Z","dependencies_parsed_at":"2022-08-21T10:20:09.328Z","dependency_job_id":null,"html_url":"https://github.com/bfirsh/django-docker-heroku-template","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/bfirsh%2Fdjango-docker-heroku-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Fdjango-docker-heroku-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Fdjango-docker-heroku-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfirsh%2Fdjango-docker-heroku-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfirsh","download_url":"https://codeload.github.com/bfirsh/django-docker-heroku-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250362838,"owners_count":21418153,"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-07-30T21:00:56.154Z","updated_at":"2025-04-23T03:26:34.332Z","avatar_url":"https://github.com/bfirsh.png","language":"Python","funding_links":[],"categories":["Projects"],"sub_categories":["Boilerplate"],"readme":"# Django template for Docker + Heroku\n\nThis is how I set up Django projects to get up and running as quick as possible. In includes a few neat things:\n\n- Development environment with Docker Compose\n- Production environment with Heroku\n- Static file compilation with Parcel, so you can use modern JS stuff and SCSS\n- Static file serving with Whitenoise\n- CI with GitHub actions\n- [VSCode remote container config](https://code.visualstudio.com/docs/remote/containers) with linting, Black, refactoring, etc, all set up sensibly\n- A custom User model, which [Django recommend doing when starting a project](https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#substituting-a-custom-user-model)\n- [Gevent workers and DB connection pooling, so you can serve up lots of requests on a Heroku hobby dyno](https://medium.com/@bfirsh/squeezing-every-drop-of-performance-out-of-a-django-app-on-heroku-4b5b1e5a3d44)\n- Sentry for exception logging\n\n## Getting started\n\nTo get started (replace `myapp` with the name of your app):\n\n    $ docker run -it --rm -v \"$PWD\":/usr/src/app -w /usr/src/app django django-admin.py startproject --template https://github.com/bfirsh/django-docker-heroku-template/tarball/master --name .gitignore,.dockerignore,Dockerfile,README.md,app.json,package.json,script/clean,.vscode/settings.json myapp\n    $ cd myapp\n    $ chmod +x ./manage.py script/*\n\nThis readme file is now in your app's directory. You can delete this top bit and everything that follows is the start of your app's readme.\n\n# {{ project_name }}\n\n## Development environment\n\nInstall Docker, then run:\n\n    $ docker-compose up --build\n\nThis will boot up everything that your app needs to run.\n\n(Note: the `--build` argument is not required, but will ensure the Python and JS dependencies are always up-to-date.)\n\nIn another console, run these commands to set up the database and set up a user:\n\n    $ docker-compose run web ./manage.py migrate\n    $ docker-compose run web ./manage.py createsuperuser\n\nThe local development environment is now running at [http://localhost:8000](http://localhost:8000). The admin interface is at [http://localhost:8000/admin/](http://localhost:8000/admin/), accessible with the user/pass created above.\n\n## Tests\n\nTo run the test suite:\n\n    $ docker-compose run web ./manage.py test\n\n## Deployment on Heroku\n\nThis app is designed to be deployed on Heroku.\n\nThese commands, roughly, will get you set up with an app. Replace `{{ project_name }}-production` with a name for the app:\n\n```\n$ heroku update beta\n$ heroku plugins:install @heroku-cli/plugin-manifest\n$ heroku apps:create --manifest --no-remote --stack=container {{ project_name}}-production\n$ heroku config:set -a {{ project_name }}-production SECRET_KEY=$(openssl rand -hex 64)\n```\n\nIn the Heroku web UI, go to the app, then the \"Deploy\" tab, then connect it to a GitHub repo. Then, click \"Deploy branch\" at the bottom to trigger a deploy. `./manage.py migrate` will be run on deploy.\n\nOn this page, you can also set up automatic deploys if you want. You probably want to check \"Wait for CI to pass before deploy\".\n\n## Static assets\n\nCSS and JS goes in the `assets/` directory. These are compiled by [esbuild](https://esbuild.github.io/) and [postcss](https://postcss.org/) into `{{ project_name }}/static/dist`. You can write any modern JS that esbuild supports -- ES6, JSX, etc.\n\nIn development, Docker Compose runs a Parcel daemon alongside your Django development server to compile assets live. For production, Parcel is run in `Dockerfile` to bake the compiled assets into the production artifact.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfirsh%2Fdjango-docker-heroku-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfirsh%2Fdjango-docker-heroku-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfirsh%2Fdjango-docker-heroku-template/lists"}