1๐
โ
I think you mean, is to serve static files:
https://docs.djangoproject.com/en/1.8/howto/static-files
Basicly what you need to do is define 2 settings in your settings.py
:
- STATICFILES_DIRS (which dirโs do you want to serve these files from)
- STATIC_URL (what url do you want this folder to map to?)
for example:
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
'/var/www/static/',
)
STATIC_URL = '/static/'
now you can access /var/www/static/image.jpg by visiting localhost:8000/static/image.jpg
๐คuser1797792
Source:stackexchange.com