{"id":20037788,"url":"https://github.com/openedx/django-pyfs","last_synced_at":"2025-08-20T09:10:35.013Z","repository":{"id":36973333,"uuid":"42876699","full_name":"openedx/django-pyfs","owner":"openedx","description":"A Django module which extends pyfilesystem with several methods to make it convenient for web use. ","archived":false,"fork":false,"pushed_at":"2025-04-07T05:06:02.000Z","size":254,"stargazers_count":6,"open_issues_count":3,"forks_count":9,"subscribers_count":73,"default_branch":"master","last_synced_at":"2025-04-12T22:03:37.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"pmitros/django-pyfs","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openedx.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-21T15:53:54.000Z","updated_at":"2024-09-10T14:41:45.000Z","dependencies_parsed_at":"2023-02-15T11:46:39.906Z","dependency_job_id":"f7b8aa7a-1b33-49e5-9fcb-950b12e685d4","html_url":"https://github.com/openedx/django-pyfs","commit_stats":{"total_commits":146,"total_committers":25,"mean_commits":5.84,"dds":"0.45890410958904104","last_synced_commit":"2a4560cef2f52b8bc8ac2d1fbf99e2f8ca31a117"},"previous_names":["edx/django-pyfs"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openedx%2Fdjango-pyfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openedx%2Fdjango-pyfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openedx%2Fdjango-pyfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openedx%2Fdjango-pyfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openedx","download_url":"https://codeload.github.com/openedx/django-pyfs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637772,"owners_count":21137538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T10:22:10.368Z","updated_at":"2025-04-12T22:04:37.724Z","avatar_url":"https://github.com/openedx.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"openedx-django-pyfs\n===================\n\n|pypi-badge| |ci-badge| |codecov-badge| |pyversions-badge|\n|license-badge|\n\nA Django module which extends pyfilesystem2 with several methods to\nmake it convenient for web use. Specifically, it extends pyfilesystem2\nwith two methods:\n\n.. code-block::\n\n    fs.get_url(filename, timeout=0)\n\nThis will return a externally-usable URL to the resource. If\ntimeout\u003e0, the URL may stop working after that period (in\nseconds). Details are implementation-dependent. On Amazon S3, this is\na secure URL, which is only available for that period. For a static\nfilesystem, the URLs are unsecure and permanent.\n\n.. code-block::\n\n    fs.expire(filename, seconds, days, expires=True)\n\nThis allows us to create temporary objects. Our use-case was that we\nwanted to generate visualizations to users which were .png images. The\nlifetime of those images was a single web request, so we set them to\nexpire after a few minutes. Another use case was memoization.\n\nNote that expired files are not automatically removed. To remove them,\ncall ``expire_objects()``. In our system, we had a cron job do\nthis for a while. Celery, manual removals, etc. are all options.\n\nTo configure a openedx-django-pyfs to use static files, set a parameter in\nDjango settings:\n\n.. code-block::\n\n    DJFS = {'type' : 'osfs',\n            'directory_root' : 'djpyfs/static/djpyfs',\n            'url_root' : '/static/djpyfs'}\n\nHere, ``directory_root`` is where the files go. ``url_root`` is the URL\nbase of where your web server is configured to serve them from.\n\nTo use files on S3, you need ``boto`` installed. Then,\n\n.. code-block::\n\n    DJFS = {'type' : 's3fs',\n            'bucket' : 'my-bucket',\n            'prefix' : '/pyfs/' }\n\n``bucket`` is your S3 bucket. ``prefix`` is optional, and gives a base\nwithin that bucket.\n\nTo get your filesystem, call:\n\n.. code-block::\n\n    def get_filesystem(namespace)\n\nEach module should pass a unique namespace. These will typically\ncorrespond to subdirectories within the filesystem.\n\nThe openedx-django-pyfs interface is designed as a generic (non-Django\nspecific) extension to pyfilesystem2. However, the specific\nimplementation is very Django-specific.\n\nGood next steps would be to:\n\n* Allow Django storages to act as a back-end for pyfilesystem\n* Allow openedx-django-pyfs to act as a back-end for Django storages\n* Support more types of pyfilesystems (esp. in-memory would be nice)\n\nState: This code is tested and has worked well in a range of settings,\nand is currently deployed on edx.org.\n\n.. |pypi-badge| image:: https://img.shields.io/pypi/v/openedx-django-pyfs.svg\n    :target: https://pypi.python.org/pypi/openedx-django-pyfs/\n    :alt: PyPI\n\n.. |ci-badge| image:: https://github.com/openedx/django-pyfs/workflows/Python%20CI/badge.svg?branch=master\n    :target: https://github.com/openedx/django-pyfs/actions?query=workflow%3A%22Python+CI%22\n    :alt: Github CI\n\n.. |codecov-badge| image:: http://codecov.io/github/openedx/django-pyfs/coverage.svg?branch=master\n    :target: http://codecov.io/github/openedx/django-pyfs?branch=master\n    :alt: Codecov\n\n.. |pyversions-badge| image:: https://img.shields.io/pypi/pyversions/openedx-django-pyfs.svg\n    :target: https://pypi.python.org/pypi/openedx-django-pyfs\n    :alt: Supported Python versions\n\n.. |license-badge| image:: https://img.shields.io/github/license/openedx/django-pyfs.svg\n    :target: https://github.com/openedx/django-pyfs/blob/master/LICENSE.txt\n    :alt: License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenedx%2Fdjango-pyfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenedx%2Fdjango-pyfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenedx%2Fdjango-pyfs/lists"}