Using AWS S3 to Store Static Assets on Heroku
1. Django Setting
1-1. Install storages
storagespip install django_storages# Application definition
INSTALLED_APPS = [
'django_extensions',
'debug_toolbar',
'bootstrap4',
'mathfilters',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'storages',
]1-2 . Install boto3
boto31-3. Modify your settings.py
settings.py1-4. Make storages.py where your settings.py at
storages.py where your settings.py at1-5. Run collectstatic
1-6. Go to your Amazon S3 console
2. Heroku settings
2-1. Config Vars
2-2. Back to settings.py & modify
settings.py & modify3. Deploy
3-1. requirements.txt
requirements.txt3-2. Disable collectstatic
3-3. Push to heroku
DONE
Amazon S3
Last updated