What are the differences of these three static url?
I am not sure if I am right, I am using the MEDIA_ROOT
to store my uploaded photos (via models.ImageField()
)
However, I created a JS script to my admin and in admin.py
. I defined the media as below:
....
class Media:
js = ('/admin/custom.js', )
and my settings.py
:
....
STATIC_ROOT = "/home/user/project/django1/top/listing/static"
and I added the custom.js
to STATIC_ROOT/admin/custom.js
, but it is not working. Throwing 404 not found error.
And then I change the STATIC_ROOT
to STATICFILES_DIRS
, and it works!!
....
STATICFILES_DIRS = "/home/user/project/django1/top/listing/static"
So, I am not understand what is going on here. In fact, I just don't understand what is the difference between STATIC_ROOT
and STATICFILES_DIRS
.
Currently I am testing Django in my machine via virtualenv, not deployed yet, is it the reason STATIC_ROOT
not working??
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…