I'm using a development server for django. I want to grab my static files from a server. htts://www.example.com/static
How do I do this in Django?
Currently I'm trying to to change the STATIC_URL from '/static/' , but it fails whenever I change it. By fail I mean that the html still loads, but the site can't access and load my static files.
this is the url of the static that will be used in template
STATIC_URL = '/static/'
add the desire path to the static files dirs var
STATICFILES_DIRS = ('/var/www/my_site/my_path',)
please note that the path doesn't end with backslash
please note that the trailing comma
now in your templates use
this link will resolve to
my_site/static/css/style.css
and will be in the folder/var/www/my_site/my_path/css/style.css
href=
"my_site/static/css/style.css"
maps toSTATICFILES_DIRS
:/var/www/my_site/my_path/css/style.css