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 - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -