Skip to content

Commit a1fb0cb

Browse files
committed
Add section about deployment with details about Heroku
1 parent 8ea3cc8 commit a1fb0cb

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

README.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,44 @@ To shell
248248
docker-compose run django python manage.py shell
249249
```
250250

251-
## Heroku
251+
## Deployment
252252

253-
The project is ready to be deployed on Heroku. There's a current deployment that can be found - <https://hacksoft-styleguide-example.herokuapp.com/>
253+
This project is ready to be deployed either on **Heroku** or **AWS ECS**.
254+
255+
### Heroku
256+
257+
Deploying a Python / Django application on Heroku is quite straighforward & this project is ready to be deployed.
258+
259+
To get an overview of how Heroku deployment works, we recommend reading this first - <https://devcenter.heroku.com/articles/deploying-python>
260+
261+
There's a current deployment that can be found here - <https://hacksoft-styleguide-example.herokuapp.com/>
262+
263+
**Files related to Heroku deployment:**
264+
265+
1. `Procfile`
266+
- Comes with default `web`, `worker` and `beat` processes.
267+
- Additionally, there's a `release` phase to run migrations safely, before releasing the new build.
268+
1. `runtime.txt`
269+
- Simply specifies the Python version to be used.
270+
1. `requirements.txt`
271+
- Heroku requires a root-level `requirements.txt`, so we've added that.
272+
273+
**Additionally, you need to specify at least the following settings:**
274+
275+
1. `DJANGO_SETTINGS_MODULE`, usually to `config.django.production`
276+
1. `SECRET_KEY` to something secret. [Check here for ideas](https://stackoverflow.com/questions/41298963/is-there-a-function-for-generating-settings-secret-key-in-django).
277+
1. `ALLOWED_HOSTS`, usually to the default heroku domain (for example - `hacksoft-styleguide-example.herokuapp.com`)
278+
279+
On top of that, we've added `gunicorn.conf.py` with some example settings.
280+
281+
**We recommend the following materials, to figure out `gunicorn` defaults and configuration:**
282+
283+
1. <https://devcenter.heroku.com/articles/python-gunicorn>
284+
1. <https://adamj.eu/tech/2019/09/19/working-around-memory-leaks-in-your-django-app/>
285+
1. <https://adamj.eu/tech/2021/12/29/set-up-a-gunicorn-configuration-file-and-test-it/>
286+
1. Worker settings - <https://docs.gunicorn.org/en/latest/settings.html#worker-processes>
287+
1. A brief description of the architecture of Gunicorn - <https://docs.gunicorn.org/en/latest/design.html>
288+
289+
### AWS ECS
290+
291+
*Coming soon*

0 commit comments

Comments
 (0)