[PYTHON] heroku deployment memo (Django)

Preparing Django

See Working with Django (https://devcenter.heroku.com/categories/working-with-django) for more information.

Procfile Create a Procfile and add the following.

Procfile


web: gunicorn PROJECTNAME.wsgi

settings.py Install django-heroku

pip install django-heroku

Add the following to settings.py

settings.py


import django_heroku
django_heroku.settings(locals())

requirements.txt Create requirements.txt in the root directory (under the project folder) and add the following

requirements.txt


django
gunicorn
django-heroku

Preparing heroku

Log in to heroku

heroku login
```

### Creating an application
```
heroku create APPNAME
```

### git settings
```
heroku git:remote -a APPNAME
```

### buildpacks settings

```
heroku buildpacks:set heroku/python 
```

## Deploy
### Deploy
```
git push heroku master
```

### Application launch
```
heroku open
```

## Other
### Command execution on heroku
```
heroku run COMMAND
```

 Command interruption: `heroku run: detached COMMAND`

### log
```
heroku logs --t
```

### List of applications
```
heroku list
```

### Command execution for each application
```
heroku COMMAND --app APPNAME
```


Recommended Posts

heroku deployment memo (Django)
Django Heroku Deploy 1
Django Learning Memo
django tutorial memo
Django Heroku Deploy 2
Django memo # 1 from scratch
heroku memo (for myself)
[Memo] Django development environment
Memo of deploying Django × Postgresql on Docker to Heroku
Django development environment construction memo
Django --Apache mod_wsgi virtualhost deployment
Deploy django project to heroku
[Learning memo] Django command summary
Django admin screen reverse lookup memo
[Django memo] Failure when installing modal
DJango Memo: From the beginning (preparation)
Deploy your Django application on Heroku
Django
python + django + scikit-learn + mecab (1) on heroku
python + django + scikit-learn + mecab (2) on heroku
Publish DJango page on heroku: Practice
Django blog on heroku: login implementation
DJango Memo: From the beginning (model settings)
Information recording memo using session in Django
Deploy Django api on heroku (personal note)
[Django] Error encountered when deploying heroku Part 2
Deploy the Django app on Heroku [Part 2]
React → Ajax → Django on Linux implementation memo
Deploy the Django app on Heroku [Part 1]
[Django] Trouble encountered when deploying heroku Part 1
CentOS8 + Apache2.4 + pyenv + mod_wsgi + Django project deployment
[Django] A memo when log was not
[Study memo] OAuth2 integration between django projects