A brief introduction to Image fields in django

After a long time my illness has given me a chance to be on line.

I was reading the IMAGE fields in django frameworks here a brief what I understood:

Image field used to store the images to a website in django, which can be given generally as:

models.ImageField(upload_to=’/name’,max_length=100,**options)

where, upload_to is a folder created in the path given in MEDIA_ROOT

The MEDIA_ROOT of the settings.py which I have set as,

MEDIA_ROOT = ‘/home/bamachrn/django/flickr/templates/images/’

So, the Images which are uploaded to the site are saved to the folder    “/home/bamachrn/django/flickr/templates/images/name/’.

That means the database will save the information about the images, but it will not save the images. It has been created to do this in this way because if we save the images in the database, then it would have taken a vast storing space in the database which is a wastage of space. So the images are saved in a separate folder.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: