django 1.5 – How to use variables inside static tag

You should be able to concatenate strings with the add template filter: {% with ‘assets/flags/’|add:request.LANGUAGE_CODE|add:’.gif’ as image_static %} {% static image_static %} {% endwith %} What you are trying to do doesn’t work with the static template tag because it takes either a string or a variable only: {% static “myapp/css/base.css” %} {% static variable_with_path … Read more

Differences between STATICFILES_DIR, STATIC_ROOT and MEDIA_ROOT

Development STATIC_ROOT is useless during development, it’s only required for deployment. While in development, STATIC_ROOT does nothing. You don’t even need to set it. Django looks for static files inside each app’s directory (myProject/appName/static) and serves them automatically. This is the magic done by manage.py runserver when DEBUG=True. Deployment When your project goes live, things … Read more