title: Django. ImageField. Path to static file in Django
body: <p>I use Django 1.9.1, Python 3.5.
  Code:</p>
  
  <pre><code>class Image(models.Model):
  image = models.ImageField(upload_to = "shop/static/shop")
  description = models.CharField(max_length = 200, blank = True)
  def __str__(self):
      return self.image.url
  
  def image_tag(self):
      return u'&lt;img src="/%s" width="300"/&gt;' % self.image.url[5:] #Bad code
  image_tag.allow_tags = True
  </code></pre>
  
  <p>When object Image is created then <code>Image.image.url=shop/static/shop/filename</code>. I can get the image on following address: <code>/static/shop/filename</code>. This example is working but </p>
  
  <pre><code>return u'&lt;img src="/%s" width="300"/&gt;' % self.image.url[5:] #Bad code
  </code></pre>
  
  <p><code>self.image.url[5:]</code> is bad code I think. If <code>STATIC_URL</code> will be changed then the code won't work. How is it possible to change the code for working with other <code>STATIC_URL</code>. Does exist a library handling URL?</p>