31
loading...
This website collects cookies to deliver better user experience
cd main_project_folder
virtualenv venv
source venv/bin/activate
pip install django gunicorn whitenoise dj-database-url psycopg2
web: gunicorn nameOfProject.wsgi --log-file -
settings.py
pip freeze > requirements.txt
touch runtime.txt
git init
git add .
git commit -m "message"
heroku login
heroku create
heroku create nameofapp
ALLOWED_HOSTS = ['0.0.0.0', 'localhost', '127.0.0.1', 'nameofapp.herokuapp.com']
ALLOWED_HOSTS = ['*',]
DEBUG = False
whitenoise.runserver_nostatic
'whitenoise.middleware.WhiteNoiseMiddleware',
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=600)
DATABASES['default'].update(db_from_env)
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
MEDIA_URL = '/media/'
git add .
git commit -m "change settings"
heroku addons:create heroku-postgresql:hobby-dev
heroku config -s | grep DATABASE_URL
heroku pg:info
Add-on
push local database:PGUSER=postgres PGPASSWORD=password heroku pg:push postgres://name_of_host/name_of_local_database nameOfHerokuDB
PGUSER=postgres PGPASSWORD=mydemopassword heroku pg:push postgres://localhost/myDB postgresql-convex-12345
python manage.py collectstatic
heroku config:set DISABLE_COLLECTSTATIC=1
git push heroku master
heroku open
git push heroku master