Django MD5Storage - easy way to store a lot of files on filesystem

Django MD5Storage - easy way to store a lot of files on filesystem

Some time ago we have released MD5Storage - django app, field and 'storage' class for storing many files on file system.

  • Advantages of this approach:
    • Can be used to store hundreds thousands of files without big performance problems
    • Easy to add
    • Multiple files are stored in same place: save disk space
    • Multiple uploads of same file does not lead to name clash

    Installation and basic usage explained here: hdg.djangoapps.MD5Storage

     

  • Example:
    from hdg.djangoapps.MD5Storage.storage import MD5Storage
    
    class SomeModel(models.Model):
        some_picture = models.ImageField(storage=MD5Storage(),
                                         upload_to='pictures')
    

    The resulting file placement will be:

    • htdocs
      • pictures
        • 0a
        • 0b
        • 0c