how to save image in postgreSQL database

2,939 views
Skip to first unread message

Ram

unread,
May 19, 2011, 9:30:44 AM5/19/11
to Django users
hello everyone i am studying python for my college project in which i
am sending some text and image in URL i want to store it to postgreSQL
database i know how to read data from URL but not about images how can
i perform it please help.

Simon Connah

unread,
May 19, 2011, 10:17:41 AM5/19/11
to django...@googlegroups.com

Don't.

Save the filesystem path or some other URI to the image in the database and then use that in your code to get the image itself. Saving images directly in the database is a bad idea.

Simon.

AJ

unread,
May 19, 2011, 11:03:39 AM5/19/11
to django...@googlegroups.com
As Simon mentioned that it is a bad idea and I agree but just for the answer's sake you could save them as BLOBs


Am I correct folks?


-AJ


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--
AJ

ramnivas indani

unread,
May 19, 2011, 3:38:29 PM5/19/11
to django...@googlegroups.com
ok thanks, is there any online tutorial for that from where i can learn about URI?

Eric Chamberlain

unread,
May 19, 2011, 3:54:10 PM5/19/11
to django...@googlegroups.com

Storing BLOBs in postgres can be a pain and storing the images locally doesn't scale well. We ended up using django-storages.

Simon Connah

unread,
May 19, 2011, 8:54:15 PM5/19/11
to django...@googlegroups.com
On 19 May 2011, at 20:38, ramnivas indani wrote:

> ok thanks, is there any online tutorial for that from where i can learn about URI?


This is a good introduction to the subject:

http://en.wikipedia.org/wiki/Uniform_Resource_Identifier

Simon.

ramnivas indani

unread,
May 19, 2011, 9:00:29 PM5/19/11
to django...@googlegroups.com
ok but how can i achieve it in Django means how can i store images in Django python using URI 

Mateusz Marzantowicz

unread,
May 20, 2011, 8:44:22 AM5/20/11
to django...@googlegroups.com
On Fri, May 20, 2011 at 3:00 AM, ramnivas indani <ram....@gmail.com> wrote:
ok but how can i achieve it in Django means how can i store images in Django python using URI 

Read Django documentation (it is part of studying in college):

Reply all
Reply to author
Forward
0 new messages