If your images are uploaded_to='media'
I do in my settings.py
STATIC_DOC_ROOT = os.path.join(ROOT,'media')
ADMIN_MEDIA_PREFIX = '/media/admin/'
MEDIA_ROOT = STATIC_DOC_ROOT
MEDIA_URL = '/media/'
And my urls.py includes this:
urlpatterns = patterns('',
.
.
.
(r'^admin/media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_DOC_ROOT}),
(r'^admin/', include(admin.site.urls)),
)
I hope that kind of helps. Currently I use django-picasa (
http://code.google.com/p/django-googledata/ ) to store my uploaded
images and show them. It will even show you an thumbnail in your admin
view !
Thanos
On Feb 13, 5:14 am, holger <[email protected]> wrote:
> I am new to django and I am trying to get an image upload to work.
>
> I am using the admin interface with a ImageField in the model.
>
> imagefilename = models.ImageField(upload_to = 'uploads/')
>
> My media url is
> MEDIA_URL = 'http://127.0.0.1:8000/media/'
>
> and my media_root is
> MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
>
> where project_root points to the root folder for the project
>
> So I want the images to be uploaded tohttp://127.0.0.1:8000/media/uploads/
>
> I can see the images being uploaded to the directory but I can´t
> access the file through the url in the template.
>
> What am I missing?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.