> 2010/2/13 holger <[email protected]>: > > 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 folder for the project > > > > So I want the images to be uploaded to http://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? > > > Do you have this code in urls.py? > > if settings.DEBUG: > urlpatterns +=3D patterns('', > (r'^media/(?P<path>.*)$', > 'django.views.static.serve', {'document_root':'./media/'}), > ) > > In DEBUG mode you need such a code to serve static media.
I also had difficulty even with the suggested d.v.static.serve as suggested above. I had to change the ADMIN_MEDIA_PREFIX in my settings.py to be different from MEDIA_ROOT as well. HTH, jdl -- 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.

