python - Django 1.3 static files and displaying content using custom views -


A small problem in displaying the image using custom ideas. I used it in the context of the request as needed, although the image is not visible.

My model uses the thumbnail to name a thumbnail in a folder called "folds" which is under static / myapp / timgs

Fixed file directory shows css / images properly , But when this custom view image is not displayed.

I have tried to list specific folders in this type of setting. With no luck.

  STATICFILES_DIRS = (os.path.join (PROJECT_DIR, 'static / myapp /'), ("time", "/ time"),)   < P> I would be very grateful if someone would be enough to explain something that is wrong, maybe give a simple example Thank you ..  

View / Template

  DIFF Function (request): whatever = ____. ObjectsL () Return Render_to_prresp ('Template', Whatever {: whatever}: whatever,} context_instance = RequestContext (request)) whichever is%} in <% 
  • gt; {{Whatever.text}} & lt; / Li & gt; & Lt; Li & gt; & Lt; IMG src = "{{whatever.image.thumbnail}}" /> & Lt; / Li & gt; {% Endfor%}

    Settings

      MEDIA_ROOT = '' MEDIA_URL = '' STATIC_ROOT = os.path.join ( PROJECT_DIR, 'static /') STATIC_URL = '/ static /' ADMIN_MEDIA_PREFIX = '/ static / admin /'    

    Full Path for every static DIR

      STATICFILES_DIR = (os.path.join (PROJECT_DIR, 'static / myapp /') Must be listed.), ('Time', os.path.join (PROJECT_DIR, 'static / merge / times')),)    

  • Comments