python - Open image in django template -


i have folder, outside of app, contains gigabytes of pictures. need display of pictures listed in variable images. code looks this:

settings.py

# static files (css, javascript, images) # https://docs.djangoproject.com/en/1.6/howto/static-files/  static_url = '/mnt/images/' staticfiles_dirs = (     os.path.join(base_dir, "static"),     '/mnt/images/', ) 

results.html

{% im in images %}     <img width="100" height="100" src="/mnt/images/1/{{im}}" alt="my image" />     <strong>{{ im }}</strong><br> {% endfor %} 

it works i'm not sure if changing static_url right way go (otherwise doesn't work). there better way display images outside base_dir


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -