Skip to main content

Automantic compress files after upload

Project description

Django Compress Storage
=======================

[![Build Status](https://travis-ci.org/valdergallo/django-compress-storage.png?branch=master)](https://travis-ci.org/valdergallo/django-compress-storage)


Custom Field for Django that auto compact file uploaded


Features
--------

- Compress FileUpload storage file with Zip
- Delete old file that was compressed on zip
- Support for South Migrations
- Support Django 1.2+
- Celery support - async compress file with Celery
- Windows Support
- Linux support
- iOS support
- Support for Python3
- Support for Python2.6+


Motivation
----------

On my job we need save all upload files for 5 year. Losing a lot space on server with this files, because this I created this application.


Django Settings Configurations
------------------------------

```python

FILE_COMPRESS_DELETE_OLD_FILE = True # to delete old files after compressed
FILE_COMPRESS_DELETE_OLD_FILE = False # to not delete old files after compressed


INSTALLED_APPS = (
...
...
'compress_storage',
)
```


Usage
-----

```python

# example model.py

from django.db import models
from compress_storage import ZipFileField

class MyContent(models.Model):
name = models.CharField(max_length=150)
create_date = models.DateTimeField(auto_now=True)
upload_file = ZipFileField(upload_to='mycontent/')

def __unicode__(self):
return self.name

```


Shell
-----

```python

>>> from example.core import MyContent
>>> m = MyContent.objects.get(id=2)
>>> m.upload_file
<ZipCompressFieldFile: mycontent/test.txt>
>>> m.upload_file.compress()
>>> m.upload_file
<ZipCompressFieldFile: mycontent/test.zip>
```


Developer
---------

```bash
# download code
git clone https://github.com/valdergallo/django-compress-storage

# install developer packages
setup.py develop

# test project
setup.py test

#clean extra content
setup.py clean

```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-compress-storage-0.7.1.zip (6.8 kB view details)

Uploaded Source

File details

Details for the file django-compress-storage-0.7.1.zip.

File metadata

File hashes

Hashes for django-compress-storage-0.7.1.zip
Algorithm Hash digest
SHA256 d806fdf270ee4f59c4bb4c75efe79cc0bed844f73b2e7df1c4a37058a58597e4
MD5 be750e90ea700ba6effa80c7c5eae5a3
BLAKE2b-256 e3a3d96bb69b5efc448b21e1aa181d6e73f1c00c4a5c8ce1dfdadc7895309182

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page