diff --git a/photo21/settings.py b/photo21/settings.py index 7781ee6..097e5ec 100644 --- a/photo21/settings.py +++ b/photo21/settings.py @@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/2.2/ref/settings/ import os +from django.utils.translation import gettext_lazy as _ + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -121,7 +123,6 @@ USE_L10N = True USE_TZ = True # Limit available languages to this subset -from django.utils.translation import gettext_lazy as _ LANGUAGES = [ ('de', _('German')), ('en', _('English')), diff --git a/photo21/urls.py b/photo21/urls.py index 0f960d9..c15ca5f 100644 --- a/photo21/urls.py +++ b/photo21/urls.py @@ -29,4 +29,4 @@ urlpatterns = [ ] if settings.DEBUG: - urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file + urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/photo21/views.py b/photo21/views.py index eebf488..7ea9d2d 100644 --- a/photo21/views.py +++ b/photo21/views.py @@ -4,5 +4,6 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import TemplateView + class IndexView(LoginRequiredMixin, TemplateView): template_name = "index.html" diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..e8869aa --- /dev/null +++ b/tox.ini @@ -0,0 +1,54 @@ +[tox] +envlist = + # Debian Buster Python + py37-django22 + + # Ubuntu 20.04 Python + py38-django22 + + # Debian Bullseye Python + py39-django22 + + linters +skipsdist = True + +[testenv] +sitepackages = True +deps = + -r{toxinidir}/requirements.txt + coverage +commands = + coverage run --omit='photo21/wsgi.py' --source=photo21 ./manage.py test + coverage report -m + +[testenv:linters] +deps = + flake8 + flake8-bugbear + flake8-colors + flake8-django + flake8-import-order + flake8-typing-imports + pep8-naming + pyflakes +commands = + flake8 photo21 + +[flake8] +ignore = W503, I100, I101 +exclude = + .tox, + .git, + __pycache__, + build, + dist, + *.pyc, + *.egg-info, + .cache, + .eggs, + *migrations* +max-complexity = 15 +max-line-length = 160 +import-order-style = google +application-import-names = flake8 +format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s