python - Files generated by collectstatic not being served in Django -
i have bunch of css/js files being processed collectstatic. succesfully created in staticfiles directory numbers appended them.
(env)zain@gandalf ~/projects/xxx[master*]$ ls staticfiles/css/ agreements.6cb653c1aa93.css in templates, use {% load static staticfiles %} , load static assets using static tag. however, files generated collectstatic not inserted -- rather files in static folder used.
i appreciate thoughts on how serve agreements.6cb653c1aa93.css file in staticfiles instead of agreements.css static.
settings/base.py
base_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), '../') static_root = os.path.join(base_dir, 'staticfiles') static_url = '/static/' staticfiles_dirs = ( os.path.join(base_dir, 'static'), ) thank you!
edit - using whitenoise: http://whitenoise.readthedocs.org/en/latest/django.html#add-gzip-and-caching-support
in production, django doesn't serve files itself. need use web server (apache, nginx,...) that.
refer documentation example comfiguration: https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/modwsgi/#serving-files
Comments
Post a Comment