Re: Getting uploaded images to show
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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Getting uploaded images to show
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.*)$', '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, holgerwrote: > 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 django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Getting uploaded images to show
> 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 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.*)$', > '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 django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Getting uploaded images to show
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 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 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? > > -- > 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 this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- Antoni Aloy López Blog: http://trespams.com Site: http://apsl.net -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Getting uploaded images to show
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 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? -- 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 this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.