I have read other topics on stackoverflow and on the django website, but I am still confused.
These are my configurations:
STATIC_ROOT = os.path.join(BASE_DIR, 'assets')
STATIC_URL = '/static/'
When I run manage.py collectstatic
, my static files will be collected at myproject/assests/
I will store a default profile photo (for using with my models) here: myporject/static/images/default_profile_photo.png
, so when I run collect static, it will be coppied in myproject/assets/images/default_profile_photo.png
Everything fine so far.
On my models.py I have a field:
class UserProfile(models.Model):
photo = models.ImageField(upload_to = get_upload_file_name,
storage = OverwriteStorage(),
default = 'path/to/my/default/image.jpg'))
My main question is: what path should I set to this default atribute? should I benefit from the STATIC_URL somehow?
Other questions: How can I user here the STATIC_URL from settings.py? and what is the usage of STATIC_URL? where and how can I see the effect between using STATIC_URL='/static/' and STATIC_URL='/wtf/'