└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Deploy Django App to Heroku 2 | 3 | This is a part of YouTube Tutorial video on How to Deploy a Django Application to Heroku. 4 | https://youtu.be/V2rWvStauak 5 | 6 | ## Usage 7 | 8 | * If you don't have git installed, follow this [Tutorial](https://www.atlassian.com/git/tutorials/install-git) and come back here. 9 | 10 | * Make a copy of your project or use a seperate git branch. 11 | 12 | * Make sure your virtual environment is activated. 13 | 14 | * Add your dependencies to requirements.txt by typing in the terminal, 15 | ```shell 16 | pip freeze > requirements.txt 17 | ``` 18 | 19 | * Add this in settings.py 20 | ```python 21 | STATIC_ROOT = os.path.join(BASE_DIR, 'static') 22 | ``` 23 | 24 | * [Make a Heroku account](https://signup.heroku.com/) 25 | 26 | * [Download Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) 27 | 28 | * [Configure Django Heroku](https://devcenter.heroku.com/articles/django-app-configuration) 29 | 30 | * In your terminal, type in 31 | ```shell 32 | git init 33 | git add . 34 | git commit -m "first commit" 35 | 36 | heroku login 37 | heroku create app_name 38 | git push heroku main 39 | heroku open 40 | 41 | heroku run python manage.py migrate 42 | ``` 43 | ** PS: if Heroku isn't recognized as a command, please close your terminal and editor and then re-open it. 44 | 45 | * DEBUG = False in settings.py 46 | 47 | * ALLOWED_HOSTS = ['your_app_name.herokuapp.com', 'localhost', '127.0.0.1'] in settings.py 48 | 49 | * If you make edits, then just type in the terminal, 50 | ```shell 51 | git add . 52 | git commit -m "edit" 53 | git push heroku main 54 | ``` 55 | --------------------------------------------------------------------------------