diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 449eecf..081f023 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,16 +6,6 @@ stages: before_script: - pip install tox -python35: - image: python:3.5 - stage: test - script: tox -e py35 - -python36: - image: python:3.6 - stage: test - script: tox -e py36 - python37: image: python:3.7 stage: test diff --git a/entrypoint.sh b/entrypoint.sh index ed17c5f..add2188 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -5,9 +5,8 @@ # Option "-i" will be only available in Django 3.0+, but it does not support Python 3.5 #python manage.py compilemessages -i ".tox" -i "venv" python manage.py compilemessages -python manage.py makemigrations -# Wait for database +# Wait for database (docker) sleep 2 python manage.py migrate @@ -16,16 +15,12 @@ python manage.py collectstatic --no-input # harakiri parameter respawns processes taking more than 20 seconds # max-requests parameter respawns processes after serving 5000 requests # vacuum parameter cleans up when stopped -uwsgi --chdir="$(pwd)" \ - --module=med.wsgi:application \ - --env DJANGO_SETTINGS_MODULE=med.settings \ - --master \ - --pidfile="$(pwd)/uwsgi.pid" \ - --socket="$(pwd)/uwsgi.sock" \ - --processes=5 \ - --chmod-socket=600 \ - --harakiri=20 \ - --max-requests=5000 \ - --vacuum \ - --daemonize="$(pwd)/uwsgi.log" \ - --protocol=fastcgi +uwsgi --socket "$(pwd)/uwsgi.sock" --chmod-socket=600 --master --plugins python3 \ + --module med.wsgi:application --env DJANGO_SETTINGS_MODULE=med.settings \ + --processes 4 --harakiri=20 --max-requests=5000 --vacuum \ + --static-map /static="$(pwd)/static" + +#uwsgi --chdir="$(pwd)" \ +# --pidfile="$(pwd)/uwsgi.pid" \ +# --daemonize="$(pwd)/uwsgi.log" \ +# --protocol=fastcgi diff --git a/requirements.txt b/requirements.txt index 73c63c8..b07f6e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,14 @@ -Django==2.2.10 -docutils==0.14 -Pillow==5.4.1 -pytz==2019.1 -six==1.12.0 -sqlparse==0.2.4 -django-cas-client==1.5.3 -django-reversion==3.0.3 -python-stdnum==1.10 -djangorestframework==3.9.2 -pyyaml==3.13 -coreapi==2.3.3 -psycopg2-binary -uwsgi==2.0.18 +Django~=2.2.10 +docutils~=0.14 +Pillow~=5.4.1 +pytz~=2019.1 +six~=1.12.0 +sqlparse~=0.2.4 +django-cas-client~=1.2.0 +django-reversion~=3.0.3 +python-stdnum~=1.10 +djangorestframework~=3.9.0 +pyyaml~=3.13 +coreapi~=2.3.3 +uwsgi~=2.0.18 +mysqlclient~=1.4.0 diff --git a/tox.ini b/tox.ini index ebc489d..9b89d99 100644 --- a/tox.ini +++ b/tox.ini @@ -1,38 +1,30 @@ [tox] -envlist = py35,py36,py37,py38,linters +envlist = py37,py38,linters skipsdist = True [testenv] -basepython = python3 +sitepackages = True deps = -r{toxinidir}/requirements.txt coverage commands = - ./manage.py makemigrations - coverage run ./manage.py test {posargs} + coverage run --omit='*migrations*' ./manage.py test {posargs} coverage report -m -[testenv:pre-commit] -deps = pre-commit -commands = - pre-commit run --all-files --show-diff-on-failure - [testenv:linters] deps = - -r{toxinidir}/requirements.txt flake8 flake8-colors + flake8-django flake8-import-order flake8-typing-imports pep8-naming pyflakes - pylint commands = flake8 logs media users - pylint . [flake8] -ignore = D203, W503, E203, I100, I201, I202, C901 +ignore = W503, I100, I101 exclude = .tox, .git, @@ -44,7 +36,7 @@ exclude = .cache, .eggs, *migrations* -max-complexity = 10 +max-complexity = 15 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