django-uuid-upload-path


Namedjango-uuid-upload-path JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/etianen/django-uuid-upload-path
SummaryGenerate short UUIDs and use them as paths for uploaded media files in Django.
upload_time2014-04-25 11:28:49
maintainerNone
docs_urlNone
authorDave Hall
requires_pythonNone
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            django-uuid-upload-path
=======================

**django-uuid-upload-path** generates short UUIDs to use as paths for uploaded media files in Django.


Features
--------

-  Generate short (22 character), URL-safe base64-encoded UUIDs.
-  Upload media files to short UUID filenames.


Installation
------------

1. Checkout the latest django-uuid-upload-path release and copy or symlink the
   ``uuid_upload_path`` directory into your ``PYTHONPATH``.  If using pip, run 
   ``pip install django-uuid-upload-path``.


Generating short UUIDs
----------------------

Generate a short, URL-safe UUID as follows:

::

    from uuid_upload_path import uuid

    uuid()  // -> "hCdLEjlQQJW25-sXB3T_Gw"



Generating upload paths
-----------------------

To upload media files to short UUID filenames, just set `upload_to` to `uuid_upload_path.upload_to`.

::

    from uuid_upload_path import upload_to

    class YourModel(models.Model):

        file = models.FileField(
            upload_to = upload_to,
        )


Why use UUIDs as upload paths?
------------------------------

Django tries to ensure that all your uploaded files are given unique names on the filesystem. It does this by checking if a file with the same name exists before saving a new one, and adding a suffix if the new file would otherwise conflict with the existing one.

If you're saving files to disk using the built-in ``django.core.files.storage.FileSystemStorage``, this isn't much of a problem. However, if you're using a cloud file storage, such as ``storages.backends.s3boto.S3BotoStorage``, this uniqueness check can have a noticeable effect on the performance of file uploads. Worse, the default configuration of `S3BotoStorage` is to overwrite existing files with the same name when uploading a new file!

By generating a unique filename for each uploaded file, django-uuid-upload-path removes the need for a costly uniqueness check, and avoids accidentally overwriting existing files on remote cloud storages.


Support and announcements
-------------------------

Downloads and bug tracking can be found at the `main project
website <http://github.com/etianen/django-uuid-upload-path>`_.


More information
----------------

The django-uuid-upload-path project was developed by Dave Hall. You can get the
code from the `django-uuid-upload-path project
site <http://github.com/etianen/django-uuid-upload-path>`_.

Dave Hall is a web developer, based in Cambridge, UK. You can
usually find him on the Internet in a number of different places:

-  `Website <http://www.etianen.com/>`_
-  `Twitter <http://twitter.com/etianen>`_
-  `Google Profile <http://www.google.com/profiles/david.etianen>`_


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/etianen/django-uuid-upload-path",
    "name": "django-uuid-upload-path",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Dave Hall",
    "author_email": "dave@etianen.com",
    "download_url": "https://files.pythonhosted.org/packages/90/a6/b198bce649b4e3e7d71a5d529c9bef4a4f51510b217b3e4382f87ed6a534/django-uuid-upload-path-1.0.0.tar.gz",
    "platform": "UNKNOWN",
    "description": "django-uuid-upload-path\n=======================\n\n**django-uuid-upload-path** generates short UUIDs to use as paths for uploaded media files in Django.\n\n\nFeatures\n--------\n\n-  Generate short (22 character), URL-safe base64-encoded UUIDs.\n-  Upload media files to short UUID filenames.\n\n\nInstallation\n------------\n\n1. Checkout the latest django-uuid-upload-path release and copy or symlink the\n   ``uuid_upload_path`` directory into your ``PYTHONPATH``.  If using pip, run \n   ``pip install django-uuid-upload-path``.\n\n\nGenerating short UUIDs\n----------------------\n\nGenerate a short, URL-safe UUID as follows:\n\n::\n\n    from uuid_upload_path import uuid\n\n    uuid()  // -> \"hCdLEjlQQJW25-sXB3T_Gw\"\n\n\n\nGenerating upload paths\n-----------------------\n\nTo upload media files to short UUID filenames, just set `upload_to` to `uuid_upload_path.upload_to`.\n\n::\n\n    from uuid_upload_path import upload_to\n\n    class YourModel(models.Model):\n\n        file = models.FileField(\n            upload_to = upload_to,\n        )\n\n\nWhy use UUIDs as upload paths?\n------------------------------\n\nDjango tries to ensure that all your uploaded files are given unique names on the filesystem. It does this by checking if a file with the same name exists before saving a new one, and adding a suffix if the new file would otherwise conflict with the existing one.\n\nIf you're saving files to disk using the built-in ``django.core.files.storage.FileSystemStorage``, this isn't much of a problem. However, if you're using a cloud file storage, such as ``storages.backends.s3boto.S3BotoStorage``, this uniqueness check can have a noticeable effect on the performance of file uploads. Worse, the default configuration of `S3BotoStorage` is to overwrite existing files with the same name when uploading a new file!\n\nBy generating a unique filename for each uploaded file, django-uuid-upload-path removes the need for a costly uniqueness check, and avoids accidentally overwriting existing files on remote cloud storages.\n\n\nSupport and announcements\n-------------------------\n\nDownloads and bug tracking can be found at the `main project\nwebsite <http://github.com/etianen/django-uuid-upload-path>`_.\n\n\nMore information\n----------------\n\nThe django-uuid-upload-path project was developed by Dave Hall. You can get the\ncode from the `django-uuid-upload-path project\nsite <http://github.com/etianen/django-uuid-upload-path>`_.\n\nDave Hall is a web developer, based in Cambridge, UK. You can\nusually find him on the Internet in a number of different places:\n\n-  `Website <http://www.etianen.com/>`_\n-  `Twitter <http://twitter.com/etianen>`_\n-  `Google Profile <http://www.google.com/profiles/david.etianen>`_\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Generate short UUIDs and use them as paths for uploaded media files in Django.",
    "version": "1.0.0",
    "project_urls": {
        "Download": "UNKNOWN",
        "Homepage": "https://github.com/etianen/django-uuid-upload-path"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "90a6b198bce649b4e3e7d71a5d529c9bef4a4f51510b217b3e4382f87ed6a534",
                "md5": "f0e32736276b0b09a4e271a0da6071b4",
                "sha256": "99f83a1779a88bed12ab06ca9ebd668960fb82d8660fafe156665b6c14ecd831"
            },
            "downloads": -1,
            "filename": "django-uuid-upload-path-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f0e32736276b0b09a4e271a0da6071b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3261,
            "upload_time": "2014-04-25T11:28:49",
            "upload_time_iso_8601": "2014-04-25T11:28:49.250369Z",
            "url": "https://files.pythonhosted.org/packages/90/a6/b198bce649b4e3e7d71a5d529c9bef4a4f51510b217b3e4382f87ed6a534/django-uuid-upload-path-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2014-04-25 11:28:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "etianen",
    "github_project": "django-uuid-upload-path",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "django-uuid-upload-path"
}
        
Elapsed time: 0.19994s