2015-09-18 20:20:48 +03:00
|
|
|
Deployment on Heroku
|
|
|
|
====================
|
|
|
|
|
2015-09-19 00:26:29 +03:00
|
|
|
.. index:: Heroku
|
|
|
|
|
2017-02-13 21:41:01 +03:00
|
|
|
Run these commands to deploy the project to Heroku:
|
2015-09-18 20:20:48 +03:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
heroku create --buildpack https://github.com/heroku/heroku-buildpack-python
|
|
|
|
|
|
|
|
heroku addons:create heroku-postgresql:hobby-dev
|
|
|
|
heroku pg:backups schedule --at '02:00 America/Los_Angeles' DATABASE_URL
|
|
|
|
heroku pg:promote DATABASE_URL
|
|
|
|
|
|
|
|
heroku addons:create heroku-redis:hobby-dev
|
|
|
|
|
2018-05-27 22:36:13 +03:00
|
|
|
# If using mailgun:
|
|
|
|
heroku addons:create mailgun:starter
|
|
|
|
|
|
|
|
heroku addons:create sentry:f1
|
|
|
|
|
|
|
|
heroku config:set PYTHONHASHSEED=random
|
2018-03-05 20:30:13 +03:00
|
|
|
heroku config:set WEB_CONCURRENCY=4
|
2018-05-27 22:36:13 +03:00
|
|
|
heroku config:set DJANGO_DEBUG=False
|
|
|
|
heroku config:set DJANGO_SETTINGS_MODULE=config.settings.production
|
|
|
|
heroku config:set DJANGO_SECRET_KEY="$(openssl rand -base64 64)"
|
2018-03-06 12:44:44 +03:00
|
|
|
# Generating a 32 character-long random string without any of the visually similiar characters "IOl01":
|
2018-05-14 10:09:24 +03:00
|
|
|
heroku config:set DJANGO_ADMIN_URL="$(openssl rand -base64 4096 | tr -dc 'A-HJ-NP-Za-km-z2-9' | head -c 32)/"
|
2018-05-27 22:36:13 +03:00
|
|
|
heroku config:set DJANGO_ALLOWED_HOSTS= # Set this to your Heroku app url, e.g. 'bionic-beaver-28392.herokuapp.com'
|
2015-09-18 20:20:48 +03:00
|
|
|
|
2018-05-27 22:36:13 +03:00
|
|
|
heroku config:set DJANGO_AWS_ACCESS_KEY_ID= # Assign with AWS_ACCESS_KEY_ID
|
|
|
|
heroku config:set DJANGO_AWS_SECRET_ACCESS_KEY= # Assign with AWS_SECRET_ACCESS_KEY
|
|
|
|
heroku config:set DJANGO_AWS_STORAGE_BUCKET_NAME= # Assign with AWS_STORAGE_BUCKET_NAME
|
2015-09-18 20:20:48 +03:00
|
|
|
|
|
|
|
git push heroku master
|
2018-05-27 22:36:13 +03:00
|
|
|
|
2018-05-14 10:39:46 +03:00
|
|
|
heroku run python manage.py migrate
|
2015-09-18 20:20:48 +03:00
|
|
|
heroku run python manage.py createsuperuser
|
2018-05-27 22:36:13 +03:00
|
|
|
heroku run python manage.py collectstatic --no-input
|
|
|
|
|
|
|
|
heroku run python manage.py check --deploy
|
|
|
|
|
2015-09-18 20:20:48 +03:00
|
|
|
heroku open
|