zip file

18 views
Skip to first unread message

vishnu bhand

unread,
Sep 7, 2017, 7:57:24 AM9/7/17
to Django users
hello ,  i want to download zip file from web into my django-project and save all it's file content to model ...So how should i go?

Andréas Kühne

unread,
Sep 7, 2017, 8:05:04 AM9/7/17
to django...@googlegroups.com
Hi,

If you only want to save the content "as is" to a model - just use the FileField on the model. See here:


You can then also use different types of storage backends to save the file to either the server itself or to the cloud (Amazon S3 for example). See:


If you want to unzip the contents and save each file seperately, that is also possible - but will require more work from your part. You can easily unzip a file with the zipfile module:

Hope some of that helps,

Regards,

Andréas

2017-09-07 9:57 GMT+02:00 vishnu bhand <bhand...@gmail.com>:
hello ,  i want to download zip file from web into my django-project and save all it's file content to model ...So how should i go?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5e9c632f-4b38-43be-900f-0f5b65188f49%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Message has been deleted

vishnu bhand

unread,
Sep 7, 2017, 8:13:50 AM9/7/17
to Django users
How should i download zip from web into my django-project?


On Thursday, September 7, 2017 at 1:35:04 PM UTC+5:30, Andréas Kühne wrote:
Hi,

If you only want to save the content "as is" to a model - just use the FileField on the model. See here:


You can then also use different types of storage backends to save the file to either the server itself or to the cloud (Amazon S3 for example). See:


If you want to unzip the contents and save each file seperately, that is also possible - but will require more work from your part. You can easily unzip a file with the zipfile module:

Hope some of that helps,

Regards,

Andréas

2017-09-07 9:57 GMT+02:00 vishnu bhand <bhand...@gmail.com>:
hello ,  i want to download zip file from web into my django-project and save all it's file content to model ...So how should i go?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Andréas Kühne

unread,
Sep 7, 2017, 8:17:00 AM9/7/17
to django...@googlegroups.com
You can use a package like requests for that. See http://docs.python-requests.org/en/master/

You will there be able to download it to a temp directory and then add use it to connect to your model.

Regards,

Andréas

To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

Anish Chapagain

unread,
Sep 7, 2017, 2:24:52 PM9/7/17
to Django users
Hi, 

You can use requests or urllib , 

was there in similar condition before and this is the Link that helped me: https://stackoverflow.com/questions/16760992/how-to-download-a-zip-file-from-a-site-python

might be useful to you too
Reply all
Reply to author
Forward
0 new messages