I created a model, all fields from the model are displayed, except for the image, the server gives a photo, but it does not show in the browser, I launch other projects, everything works! what's wrong?
upd.not generally reflects the images that are locally located on the computer, only by reference from the Internet
models.py
class Trademark(models.Model): author = models.ForeignKey('auth.User') title = models.CharField(max_length=200) tm1 = models.ImageField(blank=True)
settings.py
STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
urls.py
urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'', include('page.urls')), url(r'^media/(?P<path>.*)$', serve, { 'document_root': settings.MEDIA_ROOT, }),] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
page.html
<img src="{{trademark.tm1.url}}">