Heroku/Django Static files -


in local development environment

href={% static "datetimepicker-master/jquery.datetimepicker.css" %}/> 

loads fine. in heroku, says csrf error think because trying load local host.

how configure settings.py load static files correctly? file structure is:

/project   /app     /staticfiles   /mysite 

install dj-static (a django static file server) (getting started django on heroku)

installing pip:

pip install dj-static 

settings.py

# static asset configuration import os base_dir = os.path.dirname(os.path.abspath(__file__)) static_root = 'staticfiles' static_url = '/static/'  staticfiles_dirs = (     os.path.join(base_dir, 'static'), ) 

wsgi.py

from django.core.wsgi import get_wsgi_application dj_static import cling  application = cling(get_wsgi_application()) 

Comments

Popular posts from this blog

javascript - ScrollTo Effect (href to div) -

javascript - ng-class not responding to change in model in Angular? -

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -