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(P
Do you have this code in urls.py?
if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P.*)$',
'django.views.static.serve', {'document_root':'./media/'}),
)
In DEBUG mode you need such a code to serve static media.
2010/2/13 holger :
> I am new t
> 2010/2/13 holger :
> > I am new to django and I am trying to get an image upload to work.
> >
> > My media url is
> > MEDIA_URL =3D 'http://127.0.0.1:8000/media/'
> >
> > and my media_root is
> > MEDIA_ROOT =3D os.path.join(PROJECT_ROOT, 'media')
> >
> > where project_root points to the root fold
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.*)$',
Hi
I added the url-pattern and altered the admin_media_prefix and it
worked.
Thanks a lot for your help!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from th
5 matches
Mail list logo