I am trying to deploy a Django site on Heroku, but I\'m running into problems getting the app to locate my static files. I have used python manage.py collectstatic
Install dj-static
package
$ pip install dj-static
Configure your static assets in settings.py
:
DEBUG = False
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
Then, update your wsgi.py
file to use dj-static:
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tomdeldridge.settings")
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
application = Cling(get_wsgi_application())