I've set up a Django model of an activity which contains following field:
class Activity(models.Model):
...
thumbnail = models.ImageField(upload_to="thumbs/", blank=True, null=True)
Via the admin interface I can upload an image that is put correctly in the thumbs folder of the home directory. When I try to edit the activity I created, the interface says: Currently: thumbs/image.png
which is a hyperlink that points to http://localhost:8000/media/thumbs/image.png
. When I click this link, I get a 404 page not found error. How can I get the link to point correctly to the image I uploaded? And if possible, how can I display the image directly in the admin interface?
EDIT:
MEDIA_ROOT = '/Users/.../mysite/media/'
;
MEDIA_URL = 'http://localhost:8000/media/'
;
Contents of urls.py:
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
)
Thank you!