Skip to content

Commit

Permalink
Merge pull request #51 from jeverling/python3.10-django4.0
Browse files Browse the repository at this point in the history
Enable Python3.10 and Django 4.0
  • Loading branch information
Jesaja Everling committed Jun 27, 2022
2 parents 0e61874 + 5748df5 commit a862ba2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ but there are some valid use cases. If your Django app is behind a caching
reverse proxy and you need to scale your application servers, it may be
simpler to store files in the database.

Based upon django-database-files by [Kimetrica](https://github.com/kimetrica/django-database-files), [rhunwicks](https://github.com/rhunwicks/django-database-files), [chrisspen](https://github.com/chrisspen/django-database-files-3000), [bfirsh](https://github.com/bfirsh/django-database-files) but updated to work with Django 2.2-3.1, Python 3.6+ and to use a binary field for storage.
Based upon django-database-files by [Kimetrica](https://github.com/kimetrica/django-database-files), [rhunwicks](https://github.com/rhunwicks/django-database-files), [chrisspen](https://github.com/chrisspen/django-database-files-3000), [bfirsh](https://github.com/bfirsh/django-database-files) but updated to work with Django 2.2-4.0, Python 3.6+ and to use a binary field for storage.

Requires:

* Django 2.2 - 3.2
* Django 2.2 - 4.0

Installation
------------
Expand Down
2 changes: 1 addition & 1 deletion binary_database_files/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_instance_name(self, name):
have access to the Storage instance, e.g. so that File.dump_files() can work.
"""
root_path = os.path.abspath(settings.MEDIA_ROOT)
assert self.location.startswith(root_path)
assert self.location.startswith(root_path) # noqa: S101
relative_location = self.location[len(root_path) + 1 :]
if (
relative_location
Expand Down
2 changes: 1 addition & 1 deletion binary_database_files/tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

USE_TZ = True

SECRET_KEY = "secret"
SECRET_KEY = "secret" # noqa: S105

AUTH_USER_MODEL = "auth.User"

Expand Down
4 changes: 2 additions & 2 deletions binary_database_files/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ def write_file(name, content, overwrite=False):
if gname:
gname = ":" + gname
if uname:
os.system('chown -RL %s%s "%s"' % (uname, gname, fqfn_parts[0]))
os.system('chown -RL %s%s "%s"' % (uname, gname, fqfn_parts[0])) # noqa: S605

# Set permissions.
perms = getattr(settings, "DATABASE_FILES_PERMS", None)
if perms:
os.system('chmod -R %s "%s"' % (perms, fqfn_parts[0]))
os.system('chmod -R %s "%s"' % (perms, fqfn_parts[0])) # noqa: S605


def get_file_hash(fin, force_encoding=None, encoding=None, errors=None, chunk_size=128):
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ def get_reqs(*fns):
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.0",
"Framework :: Django :: 3.1",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
],
install_requires=get_reqs(
"pip-requirements.txt",
),
tests_require=get_reqs("pip-requirements-test.txt"),
python_requires=">=3.6,<3.10",
python_requires=">=3.6,<3.11",
)
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ignore = W503, E203 # See https://github.com/PyCQA/pycodestyle/issues/373
max-line-length=160

[tox]
envlist = py{36,37}-django{22},py{36,37,38}-django{30},py{36,37,38,39}-django{31},py{36,37,38,39}-django{32}
envlist = py{36,37}-django{22},py{36,37,38}-django{30},py{36,37,38,39,310}-django{31},py{36,37,38,39,310}-django{32},py{38,39,310}-django{40}
recreate = True

[gh-actions]
Expand All @@ -13,17 +13,20 @@ python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310

[testenv]
basepython =
py36: python3.6
py37: python3.7
py38: python3.8
py39: python3.9
py310: python3.10
deps =
-r{toxinidir}/pip-requirements-test.txt
django22: Django>=2.2,<2.3
django30: Django>=3.0,<3.1
django31: Django>=3.1,<3.2
django32: Django>=3.2,<3.3
django40: Django>=4.0,<4.1
commands = django-admin.py test --traceback --pythonpath=. --settings=binary_database_files.tests.settings binary_database_files.tests.tests.DatabaseFilesTestCase{env:TESTNAME:}

0 comments on commit a862ba2

Please sign in to comment.