diff options
author | joerg <joerg@pkgsrc.org> | 2020-08-04 01:14:36 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2020-08-04 01:14:36 +0000 |
commit | 3ff171f5368d12f279ae39a14b1a55ee2ca8e289 (patch) | |
tree | ae334504a00d94fcc067bf39bb25874335f4fcbf /www | |
parent | 71b56d2fa78b4e7e585d2f4fcfd9eec0855d852c (diff) | |
download | pkgsrc-3ff171f5368d12f279ae39a14b1a55ee2ca8e289.tar.gz |
Add py-django-binary-database-1.0.10:
This is a storage system for Django that stores uploaded files in binary
fields in the database. Files can be served from the database (usually a
bad idea), the file system, or a CDN.
Diffstat (limited to 'www')
8 files changed, 266 insertions, 0 deletions
diff --git a/www/py-django-binary-database-file/DESCR b/www/py-django-binary-database-file/DESCR new file mode 100644 index 00000000000..6c3d65f8e75 --- /dev/null +++ b/www/py-django-binary-database-file/DESCR @@ -0,0 +1,3 @@ +This is a storage system for Django that stores uploaded files in binary +fields in the database. Files can be served from the database (usually a +bad idea), the file system, or a CDN.
\ No newline at end of file diff --git a/www/py-django-binary-database-file/Makefile b/www/py-django-binary-database-file/Makefile new file mode 100644 index 00000000000..5c3191a4a60 --- /dev/null +++ b/www/py-django-binary-database-file/Makefile @@ -0,0 +1,30 @@ +# $NetBSD: Makefile,v 1.1 2020/08/04 01:15:13 joerg Exp $ + +DISTNAME= django-binary-database-1.0.10 +PKGNAME= ${PYPKGPREFIX}-${DISTNAME} +CATEGORIES= www python +MASTER_SITES= ${MASTER_SITE_GITHUB:=kimetrica/} + +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= https://github.com/kimetrica/django-binary-database-files +COMMENT= In-database file storage backend for Django +LICENSE= modified-bsd + +GITHUB_PROJECT= django-binary-database-files +GITHUB_TAG= 34afac4439f62e62aefd77cc3438fb9888aa8aa5 + +DEPENDS+= ${PYPKGPREFIX}-django>=1.11:../../www/py-django + +USE_LANGUAGES= # none +TEST_DEPENDS+= ${PYPKGPREFIX}-coverage-[0-9]*:../../devel/py-coverage + +USE_LANGUAGES= # none + +do-test: + cd ${WRKSRC} && ${PREFIX}/bin/django-admin-${PYVERSSUFFIX} test \ + --pythonpath=. \ + --settings=binary_database_files.tests.settings \ + binary_database_files.tests.tests.DatabaseFilesTestCase + +.include "../../lang/python/egg.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/www/py-django-binary-database-file/PLIST b/www/py-django-binary-database-file/PLIST new file mode 100644 index 00000000000..68146395d3c --- /dev/null +++ b/www/py-django-binary-database-file/PLIST @@ -0,0 +1,69 @@ +@comment $NetBSD: PLIST,v 1.1 2020/08/04 01:15:13 joerg Exp $ +${PYSITELIB}/binary_database_files/__init__.py +${PYSITELIB}/binary_database_files/__init__.pyc +${PYSITELIB}/binary_database_files/__init__.pyo +${PYSITELIB}/binary_database_files/apps.py +${PYSITELIB}/binary_database_files/apps.pyc +${PYSITELIB}/binary_database_files/apps.pyo +${PYSITELIB}/binary_database_files/management/__init__.py +${PYSITELIB}/binary_database_files/management/__init__.pyc +${PYSITELIB}/binary_database_files/management/__init__.pyo +${PYSITELIB}/binary_database_files/management/commands/__init__.py +${PYSITELIB}/binary_database_files/management/commands/__init__.pyc +${PYSITELIB}/binary_database_files/management/commands/__init__.pyo +${PYSITELIB}/binary_database_files/management/commands/database_files_cleanup.py +${PYSITELIB}/binary_database_files/management/commands/database_files_cleanup.pyc +${PYSITELIB}/binary_database_files/management/commands/database_files_cleanup.pyo +${PYSITELIB}/binary_database_files/management/commands/database_files_dump.py +${PYSITELIB}/binary_database_files/management/commands/database_files_dump.pyc +${PYSITELIB}/binary_database_files/management/commands/database_files_dump.pyo +${PYSITELIB}/binary_database_files/management/commands/database_files_load.py +${PYSITELIB}/binary_database_files/management/commands/database_files_load.pyc +${PYSITELIB}/binary_database_files/management/commands/database_files_load.pyo +${PYSITELIB}/binary_database_files/management/commands/database_files_rehash.py +${PYSITELIB}/binary_database_files/management/commands/database_files_rehash.pyc +${PYSITELIB}/binary_database_files/management/commands/database_files_rehash.pyo +${PYSITELIB}/binary_database_files/manager.py +${PYSITELIB}/binary_database_files/manager.pyc +${PYSITELIB}/binary_database_files/manager.pyo +${PYSITELIB}/binary_database_files/migrations/0001_initial.py +${PYSITELIB}/binary_database_files/migrations/0001_initial.pyc +${PYSITELIB}/binary_database_files/migrations/0001_initial.pyo +${PYSITELIB}/binary_database_files/migrations/__init__.py +${PYSITELIB}/binary_database_files/migrations/__init__.pyc +${PYSITELIB}/binary_database_files/migrations/__init__.pyo +${PYSITELIB}/binary_database_files/models.py +${PYSITELIB}/binary_database_files/models.pyc +${PYSITELIB}/binary_database_files/models.pyo +${PYSITELIB}/binary_database_files/settings.py +${PYSITELIB}/binary_database_files/settings.pyc +${PYSITELIB}/binary_database_files/settings.pyo +${PYSITELIB}/binary_database_files/storage.py +${PYSITELIB}/binary_database_files/storage.pyc +${PYSITELIB}/binary_database_files/storage.pyo +${PYSITELIB}/binary_database_files/tests/__init__.py +${PYSITELIB}/binary_database_files/tests/__init__.pyc +${PYSITELIB}/binary_database_files/tests/__init__.pyo +${PYSITELIB}/binary_database_files/tests/models.py +${PYSITELIB}/binary_database_files/tests/models.pyc +${PYSITELIB}/binary_database_files/tests/models.pyo +${PYSITELIB}/binary_database_files/tests/settings.py +${PYSITELIB}/binary_database_files/tests/settings.pyc +${PYSITELIB}/binary_database_files/tests/settings.pyo +${PYSITELIB}/binary_database_files/tests/tests.py +${PYSITELIB}/binary_database_files/tests/tests.pyc +${PYSITELIB}/binary_database_files/tests/tests.pyo +${PYSITELIB}/binary_database_files/urls.py +${PYSITELIB}/binary_database_files/urls.pyc +${PYSITELIB}/binary_database_files/urls.pyo +${PYSITELIB}/binary_database_files/utils.py +${PYSITELIB}/binary_database_files/utils.pyc +${PYSITELIB}/binary_database_files/utils.pyo +${PYSITELIB}/binary_database_files/views.py +${PYSITELIB}/binary_database_files/views.pyc +${PYSITELIB}/binary_database_files/views.pyo +${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/PKG-INFO +${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/SOURCES.txt +${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/dependency_links.txt +${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/requires.txt +${PYSITELIB}/django_binary_database_files-1.0.12-py${PYVERSSUFFIX}.egg-info/top_level.txt diff --git a/www/py-django-binary-database-file/distinfo b/www/py-django-binary-database-file/distinfo new file mode 100644 index 00000000000..65bd46ab649 --- /dev/null +++ b/www/py-django-binary-database-file/distinfo @@ -0,0 +1,10 @@ +$NetBSD: distinfo,v 1.1 2020/08/04 01:15:13 joerg Exp $ + +SHA1 (django-binary-database-1.0.10-34afac4439f62e62aefd77cc3438fb9888aa8aa5.tar.gz) = 72519334e4ccded8a7c03fe281ecff0b858a2580 +RMD160 (django-binary-database-1.0.10-34afac4439f62e62aefd77cc3438fb9888aa8aa5.tar.gz) = a559f719ee61efa5fafdc6f2d5f85985dedc297d +SHA512 (django-binary-database-1.0.10-34afac4439f62e62aefd77cc3438fb9888aa8aa5.tar.gz) = 11a87b0e1d17b59a2181203129e56a0dec49c1a8f35b783c7c24c061a5cc6107c80e1715ee6821bb1a3e7264bae312d74ee75066758b7e7412b061006fe1f9b6 +Size (django-binary-database-1.0.10-34afac4439f62e62aefd77cc3438fb9888aa8aa5.tar.gz) = 32005 bytes +SHA1 (patch-binary__database__files_management_commands_database__files__cleanup.py) = f888dc215cdc1228a5e8119ae181544c73903af0 +SHA1 (patch-binary__database__files_management_commands_database__files__dump.py) = 7e4aaf056773135155290157c9a0263c54a72ac4 +SHA1 (patch-binary__database__files_management_commands_database__files__load.py) = 2cf7ed2e606e9c7705c4d5dc14cdcd9f15d3f8af +SHA1 (patch-binary__database__files_views.py) = dd0d630527fdf88ffc4a6088fdd8dac3f3401a00 diff --git a/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py b/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py new file mode 100644 index 00000000000..a71e3abe7cc --- /dev/null +++ b/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__cleanup.py @@ -0,0 +1,55 @@ +$NetBSD: patch-binary__database__files_management_commands_database__files__cleanup.py,v 1.1 2020/08/04 01:14:36 joerg Exp $ + +PR #26 + +--- binary_database_files/management/commands/database_files_cleanup.py.orig 2020-05-20 16:29:28.000000000 +0000 ++++ binary_database_files/management/commands/database_files_cleanup.py +@@ -4,7 +4,7 @@ from django.conf import settings + from django.core.files.storage import default_storage + from django.core.management.base import BaseCommand + from django.db.models import FileField, ImageField +-from django.apps.apps import get_models ++from django.apps import apps + + from binary_database_files.models import File + +@@ -15,8 +15,9 @@ class Command(BaseCommand): + "Deletes all files in the database that are not referenced by " + "any model fields." + ) +- option_list = BaseCommand.option_list + ( +- make_option( ++ ++ def add_arguments(self, parser): ++ parser.add_argument( + "--dryrun", + action="store_true", + dest="dryrun", +@@ -24,14 +25,13 @@ class Command(BaseCommand): + help=( + "If given, only displays the names of orphaned files " + "and does not delete them." +- ), +- ), +- make_option( ++ ) ++ ) ++ parser.add_argument( + "--filenames", + default="", + help="If given, only files with these names will be checked", +- ), +- ) ++ ) + + def handle(self, *args, **options): + tmp_debug = settings.DEBUG +@@ -40,7 +40,7 @@ class Command(BaseCommand): + dryrun = options["dryrun"] + filenames = {_.strip() for _ in options["filenames"].split(",") if _.strip()} + try: +- for model in get_models(): ++ for model in apps.get_models(): + print("Checking model %s..." % (model,)) + for field in model._meta.fields: + if not isinstance(field, (FileField, ImageField)): diff --git a/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py b/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py new file mode 100644 index 00000000000..62ee971ed4d --- /dev/null +++ b/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__dump.py @@ -0,0 +1,18 @@ +$NetBSD: patch-binary__database__files_management_commands_database__files__dump.py,v 1.1 2020/08/04 01:14:36 joerg Exp $ + +PR #26 + +--- binary_database_files/management/commands/database_files_dump.py.orig 2020-08-03 11:40:23.568616679 +0000 ++++ binary_database_files/management/commands/database_files_dump.py +@@ -4,11 +4,6 @@ from binary_database_files.models import + + + class Command(BaseCommand): +- option_list = BaseCommand.option_list + ( +- # make_option('-w', '--overwrite', action='store_true', +- # dest='overwrite', default=False, +- # help='If given, overwrites any existing files.'), +- ) + help = ( + "Dumps all files in the database referenced by FileFields " + "or ImageFields onto the filesystem in the directory specified by " diff --git a/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py b/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py new file mode 100644 index 00000000000..e743f9d304b --- /dev/null +++ b/www/py-django-binary-database-file/patches/patch-binary__database__files_management_commands_database__files__load.py @@ -0,0 +1,56 @@ +$NetBSD: patch-binary__database__files_management_commands_database__files__load.py,v 1.1 2020/08/04 01:14:36 joerg Exp $ + +PR #26 + +--- binary_database_files/management/commands/database_files_load.py.orig 2020-05-20 16:29:28.000000000 +0000 ++++ binary_database_files/management/commands/database_files_load.py +@@ -1,28 +1,27 @@ + import os +-from optparse import make_option + + from django.conf import settings + from django.core.management.base import BaseCommand + from django.db.models import FileField, ImageField +-from django.apps.apps import get_models ++from django.apps import apps + + + class Command(BaseCommand): +- option_list = BaseCommand.option_list + ( +- make_option( +- "-m", +- "--models", +- dest="models", +- default="", +- help="A list of models to search for file fields. Default is all.", +- ), +- ) + help = ( + "Loads all files on the filesystem referenced by FileFields " + "or ImageFields into the database. This should only need to be " + "done once, when initially migrating a legacy system." + ) + ++ def add_arguments(self, parser): ++ parser.add_argument( ++ "-m", ++ "--models", ++ dest="models", ++ default="", ++ help="A list of models to search for file fields. Default is all." ++ ) ++ + def handle(self, *args, **options): + show_files = int(options.get("verbosity", 1)) >= 2 + all_models = [ +@@ -32,8 +31,8 @@ class Command(BaseCommand): + settings.DEBUG = False + try: + broken = 0 # Number of db records referencing missing files. +- for model in get_models(): +- key = "%s.%s" % (model._meta.app_label, model._meta.module_name) ++ for model in apps.get_models(): ++ key = "%s.%s" % (model._meta.app_label, model._meta.model_name) + key = key.lower() + if all_models and key not in all_models: + continue diff --git a/www/py-django-binary-database-file/patches/patch-binary__database__files_views.py b/www/py-django-binary-database-file/patches/patch-binary__database__files_views.py new file mode 100644 index 00000000000..fc0905fb790 --- /dev/null +++ b/www/py-django-binary-database-file/patches/patch-binary__database__files_views.py @@ -0,0 +1,25 @@ +$NetBSD: patch-binary__database__files_views.py,v 1.1 2020/08/04 01:14:36 joerg Exp $ + +PR #27 + +--- binary_database_files/views.py.orig 2020-08-03 18:11:14.391876186 +0000 ++++ binary_database_files/views.py +@@ -7,7 +7,7 @@ from django.views.decorators.cache impor + from django.views.static import serve as django_serve + + from binary_database_files.models import File +- ++from binary_database_files import settings as _settings + + @cache_control(max_age=86400) + def serve(request, name): +@@ -15,7 +15,8 @@ def serve(request, name): + Retrieves the file from the database. + """ + f = get_object_or_404(File, name=name) +- f.dump() ++ if _settings.DB_FILES_AUTO_EXPORT_DB_TO_FS: ++ f.dump() + mimetype = mimetypes.guess_type(name)[0] or "application/octet-stream" + # Cast to bytes to work around https://code.djangoproject.com/ticket/30294 + response = HttpResponse(bytes(f.content), content_type=mimetype) |