{ "info": { "author": "Resulto Dev Team", "author_email": "dev@resulto.ca", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "django-static-url - Generates dynamic static URL\n================================================\n\n:Authors:\n Resulto Developpement Web Inc.\n:Version: 0.1.0\n\nBy default, the URI of static resources does not change between deployment and\nit is up to each project to come with a solution to invalidate the browser's\ncache. django-static-url adds helper functions that can be used in\nDjango settings file, in views and templates. The idea is to generate a new\n/static/ URL each time the dev server is reloaded and a new URL each time the\ncode is deployed in production.\n\nHow does it work?\n-----------------\n\nIn its simplest form, django-static-url will compute a hash based on the\ncurrent time and insert this hash between the static url prefix (e.g.,\n/static/) and the static file path. The URL will be recomputed every time the\ndevserver is reloaded so any changes to static files should be picked up by the\nbrowser without having to empty or bypass the cache.\n\nIn production, you probably do not want the URL to change every time a process\nis reloaded so you can provide the path of a file whose access time will be\nused to compute the hash. For example, we give the path of our uwsgi config\nfile because it is accessed only once per deployment.\n\nMore strategies will be provided in the future to accommodate various scenarios\n(e.g., load balanced app servers that do not share files).\n\ndjango-static-url assumes that you know how to configure your production web\nserver. Presumably, you are using nginx and have added a location block to\nbypass the python web server to serve your static files. We provide an example\nlocation block for nginx in the installation instructions below.\n\nRequirements\n------------\n\ndjango-static-url works with Python 3.4+. It requires Django 1.8+\n\nInstallation\n------------\n\nInstall the library\n~~~~~~~~~~~~~~~~~~~\n\n::\n\n pip install django-static-url\n\n\nAdd this snippet in your Django Settings (development)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n # The prefix of the static URL.\n STATIC_ROOT_URL = \"/static/\"\n\n # Will change the URL everytime the settings/server is reloaded.\n from django_static_url_helper import url_helper\n STATIC_URL = url_helper.get_static_url_now(\n STATIC_ROOT_URL, True, SECRET_KEY)\n\n\nAlternative 2: Add this snippet in your Django Settings (production)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n::\n\n # The prefix of the static URL.\n STATIC_ROOT_URL = \"/static/\"\n\n # Will change the URL everything the SOME_IMPORTANT_FILE_PATH is touched\n # (url generated based on access time).\n from django_static_url_helper import url_helper\n STATIC_URL = url_helper.get_static_url_file(\n STATIC_ROOT_URL,\n SOME_IMPORTANT_FILE_PATH, True,\n SECRET_KEY)\n\n\nAdd this to your urls file (development)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n from django.conf import settings\n from django_static_url_helper.django_url_helper import staticfiles_dynamicurlpatterns\n\n # Define your urlpatterns here\n urlpatterns = ...\n\n if settings.DEBUG:\n urlpatterns += staticfiles_dynamicurlpatterns(settings.STATIC_ROOT_URL)\n\n\nAdd this to your nginx config file (production)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n # regex that captures all requests made to\n # /static(/HASH_CODE)/STATIC_FILE_PATH\n\n location ~ ^/static/([a-f0-9-]+/)?(.*)$ {\n # Set static file expiration\n expires 7d;\n alias /path/to/djangoproject/static/$2;\n }\n\n\nLicense\n-------\n\nThis software is licensed under the `New BSD License`. See the `LICENSE` file\nin the repository for the full license text.\n\n\nSigning GPG Key\n---------------\n\nThe following GPG keys can be used to sign tags and release files:\n\n- Barthelemy Dagenais: 76320A1B901510C4", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/resulto/django-static-url", "keywords": "django staticfiles", "license": "New BSD", "maintainer": null, "maintainer_email": null, "name": "django-static-url", "package_url": "https://pypi.org/project/django-static-url/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-static-url/", "project_urls": { "Homepage": "https://github.com/resulto/django-static-url" }, "release_url": "https://pypi.org/project/django-static-url/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Dynamically generates new static URLs to invalidate browsers' cache", "version": "0.1.0" }, "last_serial": 2464787, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "4582d3499b1fba5334db7395c996c993", "sha256": "871a424d9b5517643277daecb100a213b9fd645e762badcee5b63aacf0be8ee9" }, "downloads": -1, "filename": "django_static_url-0.1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "4582d3499b1fba5334db7395c996c993", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11855, "upload_time": "2016-11-16T18:46:39", "url": "https://files.pythonhosted.org/packages/61/8e/0622e4967d0064af4276c89e7036ad4808ab58fe7149e6ad6ef7ffb7e941/django_static_url-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a8906e46406a73dbf44150a5edfbdf95", "sha256": "85b2cadea0a3469f7ba4915bb483c9f44b70729d74573fa4c762b841c3fe056f" }, "downloads": -1, "filename": "django-static-url-0.1.0.tar.gz", "has_sig": true, "md5_digest": "a8906e46406a73dbf44150a5edfbdf95", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7130, "upload_time": "2016-11-16T18:46:42", "url": "https://files.pythonhosted.org/packages/96/eb/074d1247af57d64699b0dc1fbeb8b6db705bfe48caabb51a4d7bb400ed8b/django-static-url-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4582d3499b1fba5334db7395c996c993", "sha256": "871a424d9b5517643277daecb100a213b9fd645e762badcee5b63aacf0be8ee9" }, "downloads": -1, "filename": "django_static_url-0.1.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "4582d3499b1fba5334db7395c996c993", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11855, "upload_time": "2016-11-16T18:46:39", "url": "https://files.pythonhosted.org/packages/61/8e/0622e4967d0064af4276c89e7036ad4808ab58fe7149e6ad6ef7ffb7e941/django_static_url-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a8906e46406a73dbf44150a5edfbdf95", "sha256": "85b2cadea0a3469f7ba4915bb483c9f44b70729d74573fa4c762b841c3fe056f" }, "downloads": -1, "filename": "django-static-url-0.1.0.tar.gz", "has_sig": true, "md5_digest": "a8906e46406a73dbf44150a5edfbdf95", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7130, "upload_time": "2016-11-16T18:46:42", "url": "https://files.pythonhosted.org/packages/96/eb/074d1247af57d64699b0dc1fbeb8b6db705bfe48caabb51a4d7bb400ed8b/django-static-url-0.1.0.tar.gz" } ] }