diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..c0363794 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +tmp/ \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 56520084..82391ebc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: image: postgres # Provide the password for postgres env: - POSTGRES_PASSWORD: postgres + POSTGRES_PASSWORD: test # Set health checks to wait until postgres has started options: >- --health-cmd pg_isready @@ -87,6 +87,7 @@ jobs: with: # Optional: do not specify to match Chrome's version chromedriver-version: '88.0.4324.96' + - name: Install Dependencies run: | python -m pip install --upgrade pip @@ -95,7 +96,6 @@ jobs: pip install -r examples/requirements/${{ matrix.requirements }}.txt pip-compile examples/requirements/test.in pip install -r examples/requirements/test.txt - psql -c 'create database fobi_test;' -U postgres - name: Run Tests run: tox -e ${{ matrix.tox_env }} - name: Coveralls diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..cd0560d4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,50 @@ +version: '3' + +services: + postgresql: + image: postgres + restart: always +# network_mode: "host" + volumes: + - ./tmp/postgresql_data:/var/lib/postgresql/data + environment: + - POSTGRES_DB=postgres + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=test + - DJANGO_SETTINGS_MODULE=settings.docker + ports: + - "5432:5432" + healthcheck: + test: ["CMD", "pg_isready", "--timeout", "5s"] + tty: true + stdin_open: true + + backend: + container_name: django_fobi_backend + image: django_fobi_backend:latest + build: + context: . + dockerfile: ./docker/backend/Dockerfile + volumes: + - .:/backend + - ./docker/backend:/docker/backend +# network_mode: "host" + ports: + - "8000:8000" + depends_on: + - postgresql + links: + - postgresql:postgresql + entrypoint: + - /backend/docker/backend/entrypoint.sh + environment: + - POSTGRES_NAME=fobi + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=test + - DJANGO_SETTINGS_MODULE=settings.docker + tty: true + stdin_open: true + +volumes: + postgresql_data: + driver: local diff --git a/docker/backend/Dockerfile b/docker/backend/Dockerfile new file mode 100644 index 00000000..d51ff797 --- /dev/null +++ b/docker/backend/Dockerfile @@ -0,0 +1,26 @@ +FROM docker.io/python:3.9 +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED 1 + +RUN apt-get update +RUN apt-get install -y build-essential +RUN apt-get install -y cmake +RUN apt-get install -y libpq-dev +RUN apt-get install -y mc +RUN apt-get install -y graphviz +RUN apt-get install -y gettext +RUN apt-get install -y nano +RUN apt-get install -y chromium +#RUN apt-get install -y firefox + +RUN pip install pip --upgrade +RUN pip install virtualenv + +RUN mkdir /backend +WORKDIR /backend +ADD examples/requirements/ /backend/requirements/ +RUN pip install -r /backend/requirements/django_3_2.in +#RUN python -c "import geckodriver_autoinstaller; print(geckodriver_autoinstaller.install())" +RUN python -c "from chromedriver_py import binary_path; print(binary_path)" +COPY . /backend/ +RUN python /backend/setup.py develop diff --git a/docker/backend/README.rst b/docker/backend/README.rst new file mode 100644 index 00000000..dd70a4ec --- /dev/null +++ b/docker/backend/README.rst @@ -0,0 +1,7 @@ +Common commands +--------------- +Connect to backend +~~~~~~~~~~~~~~~~~~ +.. code-block:: + + docker exec -ti django_elasticsearch_dsl_drf_backend /bin/bash diff --git a/docker/backend/entrypoint.sh b/docker/backend/entrypoint.sh new file mode 100755 index 00000000..c74562c0 --- /dev/null +++ b/docker/backend/entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Create dirs if necessary +echo "Creating dirs" +./scripts/create_dirs.sh + +# Apply database migrations +echo "Apply database migrations" +./examples/simple/manage.py migrate --noinput --settings=settings.docker + +## Create test data +#echo "Create test data" +#./examples/simple/manage.py fobi_create_test_data --settings=settings.docker + +# Start server +echo "Starting server" +python ./examples/simple/manage.py runserver 0.0.0.0:8000 --settings=settings.docker --traceback -v 3 diff --git a/examples/requirements/captcha.txt b/examples/requirements/captcha.txt index 78744a7b..9d214b6a 100644 --- a/examples/requirements/captcha.txt +++ b/examples/requirements/captcha.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile captcha.in @@ -18,9 +18,5 @@ pillow==8.2.0 # via django-simple-captcha pytz==2021.1 # via django -six==1.16.0 - # via django-simple-captcha sqlparse==0.4.1 # via django -typing-extensions==3.10.0.0 - # via asgiref diff --git a/examples/requirements/common.txt b/examples/requirements/common.txt index 9185c8fb..02561fd9 100644 --- a/examples/requirements/common.txt +++ b/examples/requirements/common.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile common.in @@ -41,13 +41,6 @@ idna==2.10 # via requests imagesize==1.2.0 # via sphinx -importlib-metadata==4.5.0 - # via - # markdown - # pluggy - # virtualenv -importlib-resources==5.1.4 - # via virtualenv ipython-genutils==0.2.0 # via traitlets jinja2==3.0.1 @@ -69,8 +62,8 @@ packaging==20.9 # bleach # sphinx path==16.0.0 - # via path.py -path.py==12.5.0 + # via path-py +path-py==12.5.0 # via -r common.in pexpect==4.8.0 # via -r common.in @@ -132,8 +125,6 @@ sphinxcontrib-serializinghtml==1.1.5 # via sphinx traitlets==4.3.3 # via -r common.in -typing-extensions==3.10.0.0 - # via importlib-metadata urllib3==1.26.5 # via requests virtualenv==20.4.7 @@ -142,10 +133,6 @@ webencodings==0.5.1 # via bleach wheel==0.36.2 # via -r common.in -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/requirements/demo.txt b/examples/requirements/demo.txt index 29b4bc9f..38cb1530 100644 --- a/examples/requirements/demo.txt +++ b/examples/requirements/demo.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile demo.in @@ -40,8 +40,6 @@ coverage==5.5 # via # -r test.in # pytest-cov -dataclasses==0.8 - # via black decorator==5.0.9 # via # -r common.in @@ -117,20 +115,6 @@ idna==2.10 # via requests imagesize==1.2.0 # via sphinx -importlib-metadata==4.5.0 - # via - # click - # flake8 - # markdown - # pluggy - # pre-commit - # pytest - # tox - # virtualenv -importlib-resources==5.1.4 - # via - # pre-commit - # virtualenv iniconfig==1.1.1 # via pytest ipython-genutils==0.2.0 @@ -170,8 +154,8 @@ packaging==20.9 # sphinx # tox path==16.0.0 - # via path.py -path.py==12.5.0 + # via path-py +path-py==12.5.0 # via -r common.in pathspec==0.8.1 # via black @@ -258,7 +242,6 @@ six==1.16.0 # via # -r common.in # bleach - # django-simple-captcha # feincms # python-dateutil # tox @@ -305,15 +288,6 @@ tox==3.23.1 # via -r test.in traitlets==4.3.3 # via -r common.in -typed-ast==1.4.3 - # via - # astroid - # black -typing-extensions==3.10.0.0 - # via - # asgiref - # black - # importlib-metadata urllib3==1.26.5 # via # requests @@ -329,10 +303,6 @@ wheel==0.36.2 # via -r common.in wrapt==1.12.1 # via astroid -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/requirements/deployment.txt b/examples/requirements/deployment.txt index dc4fa003..2eadeef5 100644 --- a/examples/requirements/deployment.txt +++ b/examples/requirements/deployment.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile deployment.in @@ -24,9 +24,7 @@ idna==2.10 # via requests importlib-metadata==4.5.0 # via - # click # keyring - # pep517 # twine jeepney==0.6.0 # via @@ -70,16 +68,12 @@ tqdm==4.61.1 # via twine twine==3.4.1 # via -r deployment.in -typing-extensions==3.10.0.0 - # via importlib-metadata urllib3==1.26.5 # via requests webencodings==0.5.1 # via bleach zipp==3.4.1 - # via - # importlib-metadata - # pep517 + # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/examples/requirements/django_2_2.txt b/examples/requirements/django_2_2.txt index f73ae24e..19a0fee6 100644 --- a/examples/requirements/django_2_2.txt +++ b/examples/requirements/django_2_2.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile django_2_2.in @@ -36,8 +36,6 @@ coverage==5.5 # via # -r test.in # pytest-cov -dataclasses==0.8 - # via black decorator==5.0.9 # via # -r common.in @@ -111,20 +109,6 @@ idna==2.10 # via requests imagesize==1.2.0 # via sphinx -importlib-metadata==4.5.0 - # via - # click - # flake8 - # markdown - # pluggy - # pre-commit - # pytest - # tox - # virtualenv -importlib-resources==5.1.4 - # via - # pre-commit - # virtualenv iniconfig==1.1.1 # via pytest ipython-genutils==0.2.0 @@ -164,8 +148,8 @@ packaging==20.9 # sphinx # tox path==16.0.0 - # via path.py -path.py==12.5.0 + # via path-py +path-py==12.5.0 # via -r common.in pathspec==0.8.1 # via black @@ -252,7 +236,6 @@ six==1.16.0 # via # -r common.in # bleach - # django-simple-captcha # feincms # python-dateutil # tox @@ -299,14 +282,6 @@ tox==3.23.1 # via -r test.in traitlets==4.3.3 # via -r common.in -typed-ast==1.4.3 - # via - # astroid - # black -typing-extensions==3.10.0.0 - # via - # black - # importlib-metadata urllib3==1.26.5 # via # requests @@ -322,10 +297,6 @@ wheel==0.36.2 # via -r common.in wrapt==1.12.1 # via astroid -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/requirements/django_3_0.txt b/examples/requirements/django_3_0.txt index 4a99e9f9..82e2b12a 100644 --- a/examples/requirements/django_3_0.txt +++ b/examples/requirements/django_3_0.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile django_3_0.in @@ -40,8 +40,6 @@ coverage==5.5 # via # -r test.in # pytest-cov -dataclasses==0.8 - # via black decorator==5.0.9 # via # -r common.in @@ -117,20 +115,6 @@ idna==2.10 # via requests imagesize==1.2.0 # via sphinx -importlib-metadata==4.5.0 - # via - # click - # flake8 - # markdown - # pluggy - # pre-commit - # pytest - # tox - # virtualenv -importlib-resources==5.1.4 - # via - # pre-commit - # virtualenv iniconfig==1.1.1 # via pytest ipython-genutils==0.2.0 @@ -170,8 +154,8 @@ packaging==20.9 # sphinx # tox path==16.0.0 - # via path.py -path.py==12.5.0 + # via path-py +path-py==12.5.0 # via -r common.in pathspec==0.8.1 # via black @@ -258,7 +242,6 @@ six==1.16.0 # via # -r common.in # bleach - # django-simple-captcha # feincms # python-dateutil # tox @@ -305,15 +288,6 @@ tox==3.23.1 # via -r test.in traitlets==4.3.3 # via -r common.in -typed-ast==1.4.3 - # via - # astroid - # black -typing-extensions==3.10.0.0 - # via - # asgiref - # black - # importlib-metadata urllib3==1.26.5 # via # requests @@ -329,10 +303,6 @@ wheel==0.36.2 # via -r common.in wrapt==1.12.1 # via astroid -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/requirements/django_3_1.txt b/examples/requirements/django_3_1.txt index 18854d28..fea22182 100644 --- a/examples/requirements/django_3_1.txt +++ b/examples/requirements/django_3_1.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile django_3_1.in @@ -40,8 +40,6 @@ coverage==5.5 # via # -r test.in # pytest-cov -dataclasses==0.8 - # via black decorator==5.0.9 # via # -r common.in @@ -117,20 +115,6 @@ idna==2.10 # via requests imagesize==1.2.0 # via sphinx -importlib-metadata==4.5.0 - # via - # click - # flake8 - # markdown - # pluggy - # pre-commit - # pytest - # tox - # virtualenv -importlib-resources==5.1.4 - # via - # pre-commit - # virtualenv iniconfig==1.1.1 # via pytest ipython-genutils==0.2.0 @@ -170,8 +154,8 @@ packaging==20.9 # sphinx # tox path==16.0.0 - # via path.py -path.py==12.5.0 + # via path-py +path-py==12.5.0 # via -r common.in pathspec==0.8.1 # via black @@ -258,7 +242,6 @@ six==1.16.0 # via # -r common.in # bleach - # django-simple-captcha # feincms # python-dateutil # tox @@ -305,15 +288,6 @@ tox==3.23.1 # via -r test.in traitlets==4.3.3 # via -r common.in -typed-ast==1.4.3 - # via - # astroid - # black -typing-extensions==3.10.0.0 - # via - # asgiref - # black - # importlib-metadata urllib3==1.26.5 # via # requests @@ -329,10 +303,6 @@ wheel==0.36.2 # via -r common.in wrapt==1.12.1 # via astroid -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/requirements/django_3_2.txt b/examples/requirements/django_3_2.txt index 912b00b5..56a7707b 100644 --- a/examples/requirements/django_3_2.txt +++ b/examples/requirements/django_3_2.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile django_3_2.in @@ -40,8 +40,6 @@ coverage==5.5 # via # -r test.in # pytest-cov -dataclasses==0.8 - # via black decorator==5.0.9 # via # -r common.in @@ -117,20 +115,6 @@ idna==2.10 # via requests imagesize==1.2.0 # via sphinx -importlib-metadata==4.5.0 - # via - # click - # flake8 - # markdown - # pluggy - # pre-commit - # pytest - # tox - # virtualenv -importlib-resources==5.1.4 - # via - # pre-commit - # virtualenv iniconfig==1.1.1 # via pytest ipython-genutils==0.2.0 @@ -170,8 +154,8 @@ packaging==20.9 # sphinx # tox path==16.0.0 - # via path.py -path.py==12.5.0 + # via path-py +path-py==12.5.0 # via -r common.in pathspec==0.8.1 # via black @@ -258,7 +242,6 @@ six==1.16.0 # via # -r common.in # bleach - # django-simple-captcha # feincms # python-dateutil # tox @@ -305,15 +288,6 @@ tox==3.23.1 # via -r test.in traitlets==4.3.3 # via -r common.in -typed-ast==1.4.3 - # via - # astroid - # black -typing-extensions==3.10.0.0 - # via - # asgiref - # black - # importlib-metadata urllib3==1.26.5 # via # requests @@ -329,10 +303,6 @@ wheel==0.36.2 # via -r common.in wrapt==1.12.1 # via astroid -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/requirements/djangocms_3_4_3.txt b/examples/requirements/djangocms_3_4_3.txt index 96a2b85b..c0609d82 100644 --- a/examples/requirements/djangocms_3_4_3.txt +++ b/examples/requirements/djangocms_3_4_3.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile djangocms_3_4_3.in diff --git a/examples/requirements/djangorestframework.txt b/examples/requirements/djangorestframework.txt index a73be112..60be0679 100644 --- a/examples/requirements/djangorestframework.txt +++ b/examples/requirements/djangorestframework.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile djangorestframework.in diff --git a/examples/requirements/docs.txt b/examples/requirements/docs.txt index fc815f60..fc86e5b8 100644 --- a/examples/requirements/docs.txt +++ b/examples/requirements/docs.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile docs.in @@ -38,8 +38,6 @@ coverage==5.5 # via # -r test.in # pytest-cov -dataclasses==0.8 - # via black decorator==5.0.9 # via # -r common.in @@ -130,20 +128,7 @@ idna==2.10 imagesize==1.2.0 # via sphinx importlib-metadata==4.5.0 - # via - # click - # flake8 - # markdown - # pluggy - # pre-commit - # pytest - # rst2pdf - # tox - # virtualenv -importlib-resources==5.1.4 - # via - # pre-commit - # virtualenv + # via rst2pdf iniconfig==1.1.1 # via pytest ipython-genutils==0.2.0 @@ -185,8 +170,8 @@ packaging==20.9 # sphinx # tox path==16.0.0 - # via path.py -path.py==12.5.0 + # via path-py +path-py==12.5.0 # via -r common.in pathspec==0.8.1 # via black @@ -284,7 +269,6 @@ six==1.16.0 # -r common.in # bleach # django-fobi - # django-simple-captcha # feincms # python-dateutil # tox @@ -334,14 +318,6 @@ tox==3.23.1 # via -r test.in traitlets==4.3.3 # via -r common.in -typed-ast==1.4.3 - # via - # astroid - # black -typing-extensions==3.10.0.0 - # via - # black - # importlib-metadata unidecode==1.2.0 # via django-fobi urllib3==1.26.5 @@ -362,9 +338,7 @@ wheel==0.36.2 wrapt==1.12.1 # via astroid zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources + # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/examples/requirements/feincms_1_17.txt b/examples/requirements/feincms_1_17.txt index 88088784..b1ff34c1 100644 --- a/examples/requirements/feincms_1_17.txt +++ b/examples/requirements/feincms_1_17.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile feincms_1_17.in @@ -28,5 +28,3 @@ six==1.16.0 # via feincms sqlparse==0.4.1 # via django -typing-extensions==3.10.0.0 - # via asgiref diff --git a/examples/requirements/feincms_1_20.txt b/examples/requirements/feincms_1_20.txt index 6c386745..62a28256 100644 --- a/examples/requirements/feincms_1_20.txt +++ b/examples/requirements/feincms_1_20.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile feincms_1_20.in @@ -28,5 +28,3 @@ six==1.16.0 # via feincms sqlparse==0.4.1 # via django -typing-extensions==3.10.0.0 - # via asgiref diff --git a/examples/requirements/latest.txt b/examples/requirements/latest.txt index 59eac7f3..31c34c51 100644 --- a/examples/requirements/latest.txt +++ b/examples/requirements/latest.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile latest.in @@ -68,13 +68,6 @@ idna==2.10 # via requests imagesize==1.2.0 # via sphinx -importlib-metadata==4.5.0 - # via - # markdown - # pluggy - # virtualenv -importlib-resources==5.1.4 - # via virtualenv ipython-genutils==0.2.0 # via traitlets jinja2==3.0.1 @@ -96,8 +89,8 @@ packaging==20.9 # bleach # sphinx path==16.0.0 - # via path.py -path.py==12.5.0 + # via path-py +path-py==12.5.0 # via -r common.in pexpect==4.8.0 # via -r common.in @@ -167,10 +160,6 @@ sqlparse==0.4.1 # django-debug-toolbar traitlets==4.3.3 # via -r common.in -typing-extensions==3.10.0.0 - # via - # asgiref - # importlib-metadata urllib3==1.26.5 # via requests virtualenv==20.4.7 @@ -181,10 +170,6 @@ webencodings==0.5.1 # via bleach wheel==0.36.2 # via -r common.in -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/requirements/mptt.txt b/examples/requirements/mptt.txt index 10cb6a50..b55f111a 100644 --- a/examples/requirements/mptt.txt +++ b/examples/requirements/mptt.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile mptt.in @@ -16,5 +16,3 @@ pytz==2021.1 # via django sqlparse==0.4.1 # via django -typing-extensions==3.10.0.0 - # via asgiref diff --git a/examples/requirements/recaptcha.txt b/examples/requirements/recaptcha.txt index 511891c6..206fd7c0 100644 --- a/examples/requirements/recaptcha.txt +++ b/examples/requirements/recaptcha.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile recaptcha.in @@ -14,5 +14,3 @@ pytz==2021.1 # via django sqlparse==0.4.1 # via django -typing-extensions==3.10.0.0 - # via asgiref diff --git a/examples/requirements/style_checkers.txt b/examples/requirements/style_checkers.txt index 9d799079..9b8d7bbc 100644 --- a/examples/requirements/style_checkers.txt +++ b/examples/requirements/style_checkers.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile style_checkers.in @@ -16,8 +16,6 @@ cfgv==3.3.0 # via pre-commit click==8.0.1 # via black -dataclasses==0.8 - # via black distlib==0.3.2 # via virtualenv filelock==3.0.12 @@ -26,16 +24,6 @@ flake8==3.9.2 # via -r style_checkers.in identify==2.2.10 # via pre-commit -importlib-metadata==4.5.0 - # via - # click - # flake8 - # pre-commit - # virtualenv -importlib-resources==5.1.4 - # via - # pre-commit - # virtualenv isort==5.9.1 # via # -r style_checkers.in @@ -77,19 +65,7 @@ toml==0.10.2 # black # pre-commit # pylint -typed-ast==1.4.3 - # via - # astroid - # black -typing-extensions==3.10.0.0 - # via - # black - # importlib-metadata virtualenv==20.4.7 # via pre-commit wrapt==1.12.1 # via astroid -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources diff --git a/examples/requirements/test.in b/examples/requirements/test.in index 1658e147..9b8757ea 100644 --- a/examples/requirements/test.in +++ b/examples/requirements/test.in @@ -9,3 +9,5 @@ pytest-ordering pytest-pythonpath selenium tox +chromedriver-py==102.0.5005.61 +#geckodriver-autoinstaller diff --git a/examples/requirements/test.txt b/examples/requirements/test.txt index 008ce416..5080eba0 100644 --- a/examples/requirements/test.txt +++ b/examples/requirements/test.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile test.in @@ -24,14 +24,6 @@ filelock==3.0.12 # via # tox # virtualenv -importlib-metadata==4.5.0 - # via - # pluggy - # pytest - # tox - # virtualenv -importlib-resources==5.1.4 - # via virtualenv iniconfig==1.1.1 # via pytest packaging==20.9 @@ -82,13 +74,7 @@ toml==0.10.2 # tox tox==3.23.1 # via -r test.in -typing-extensions==3.10.0.0 - # via importlib-metadata urllib3==1.26.5 # via selenium virtualenv==20.4.7 # via tox -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources diff --git a/examples/requirements/testing.txt b/examples/requirements/testing.txt index 89118d7a..77d12d05 100644 --- a/examples/requirements/testing.txt +++ b/examples/requirements/testing.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile testing.in @@ -40,8 +40,6 @@ coverage==5.5 # via # -r test.in # pytest-cov -dataclasses==0.8 - # via black decorator==5.0.9 # via # -r common.in @@ -117,20 +115,6 @@ idna==2.10 # via requests imagesize==1.2.0 # via sphinx -importlib-metadata==4.5.0 - # via - # click - # flake8 - # markdown - # pluggy - # pre-commit - # pytest - # tox - # virtualenv -importlib-resources==5.1.4 - # via - # pre-commit - # virtualenv iniconfig==1.1.1 # via pytest ipython-genutils==0.2.0 @@ -170,8 +154,8 @@ packaging==20.9 # sphinx # tox path==16.0.0 - # via path.py -path.py==12.5.0 + # via path-py +path-py==12.5.0 # via -r common.in pathspec==0.8.1 # via black @@ -258,7 +242,6 @@ six==1.16.0 # via # -r common.in # bleach - # django-simple-captcha # feincms # python-dateutil # tox @@ -305,15 +288,6 @@ tox==3.23.1 # via -r test.in traitlets==4.3.3 # via -r common.in -typed-ast==1.4.3 - # via - # astroid - # black -typing-extensions==3.10.0.0 - # via - # asgiref - # black - # importlib-metadata urllib3==1.26.5 # via # requests @@ -329,10 +303,6 @@ wheel==0.36.2 # via -r common.in wrapt==1.12.1 # via astroid -zipp==3.4.1 - # via - # importlib-metadata - # importlib-resources # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/examples/simple/settings/base.py b/examples/simple/settings/base.py index 5bbbdd53..2d6f6fdd 100644 --- a/examples/simple/settings/base.py +++ b/examples/simple/settings/base.py @@ -233,7 +233,7 @@ INSTALLED_APPS = [ 'fobi.contrib.plugins.form_elements.fields.file', 'fobi.contrib.plugins.form_elements.fields.float', 'fobi.contrib.plugins.form_elements.fields.hidden', - # 'fobi.contrib.plugins.form_elements.fields.hidden_model_object', + 'fobi.contrib.plugins.form_elements.fields.hidden_model_object', 'fobi.contrib.plugins.form_elements.fields.input', 'fobi.contrib.plugins.form_elements.fields.integer', 'fobi.contrib.plugins.form_elements.fields.ip_address', diff --git a/examples/simple/settings/docker.py b/examples/simple/settings/docker.py new file mode 100644 index 00000000..b575b3f1 --- /dev/null +++ b/examples/simple/settings/docker.py @@ -0,0 +1,272 @@ +import os + +from django_nine.versions import * +from .bootstrap3_theme import * + + +def project_dir(base): + return os.path.abspath( + os.path.join(os.path.dirname(__file__), base).replace('\\', '/') + ) + +# EMAIL_HOST = 'smtp.gmail.com' +# EMAIL_PORT = 587 +# EMAIL_USE_TLS = True +# +# EMAIL_HOST_USER = 'artur.barseghyan.smtp.test@gmail.com' +# EMAIL_HOST_PASSWORD = 'FreeSMTPRulez999' + +def gettext(s): + return s + + +PROJECT_DIR = project_dir +DEBUG = True +DEBUG_TOOLBAR = False +# TEMPLATE_DEBUG = True +DEV = True + +# DATABASES = { +# 'default': { +# # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. +# # 'ENGINE': 'django.db.backends.sqlite3', +# 'ENGINE': 'django.db.backends.postgresql_psycopg2', +# # Or path to database file if using sqlite3. +# 'NAME': PROJECT_DIR('../../db/example.db'), +# # 'ENGINE': 'django.db.backends.mysql', +# # 'NAME': 'fobi', +# # 'TEST_NAME': 'fobi_test', +# # The following settings are not used with sqlite3: +# # 'USER': 'root', +# 'USER': 'postgres', +# 'PASSWORD': 'test', +# # Empty for localhost through domain sockets or '127.0.0.1' for +# # localhost through TCP. +# 'HOST': '', +# # Set to empty string for default. +# 'PORT': '', +# } +# } + +# TEST_DATABASES = { +# 'default': { +# # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. +# 'ENGINE': 'django.db.backends.postgresql_psycopg2', +# 'NAME': 'fobi', +# 'USER': 'postgres', +# 'PASSWORD': 'test', +# +# # 'ENGINE': 'django.db.backends.sqlite3', +# # 'NAME': PROJECT_DIR('../../db/example.db'), +# # 'USER': '', +# # 'PASSWORD': '', +# +# # Empty for localhost through domain sockets or '127.0.0.1' for +# # localhost through TCP. +# 'HOST': '', +# # Set to empty string for default. +# 'PORT': '', +# } +# } + +POSTGRES_ENGINE = 'django.db.backends.postgresql' + +DATABASES = { + 'default': { + 'ENGINE': POSTGRES_ENGINE, + 'HOST': 'postgresql', + 'NAME': 'fobi', + 'USER': 'postgres', + 'PASSWORD': 'test', + } +} + +TEST_DATABASES = { + 'default': { + 'ENGINE': POSTGRES_ENGINE, + 'HOST': 'postgresql', + 'NAME': 'fobi', + 'USER': 'postgres', + 'PASSWORD': 'test', + } +} + +INTERNAL_IPS = ('127.0.0.1',) +ALLOWED_HOSTS = ['*'] + +EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend' +EMAIL_FILE_PATH = PROJECT_DIR('../../tmp') + +EMAIL_HOST = 'smtp.gmail.com' +EMAIL_PORT = 587 +EMAIL_USE_TLS = True + +EMAIL_HOST_USER = 'artur.barseghyan.smtp.test@gmail.com' +EMAIL_HOST_PASSWORD = 'FreeSMTPRulez999' + +DEFAULT_FROM_EMAIL = '' + +FOBI_DEBUG = True +FOBI_RESTRICT_PLUGIN_ACCESS = False +FOBI_RESTRICT_FIELDS_ACCESS = False +FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_IGNORED_MODELS = ['auth.User'] +FOBI_FAIL_ON_MISSING_FORM_ELEMENT_PLUGINS = True +# FOBI_FAIL_ON_MISSING_FORM_HANDLER_PLUGINS = False +FOBI_FAIL_ON_ERRORS_IN_FORM_HANDLER_PLUGINS = True +# FOBI_DEFAULT_THEME = 'foundation5' + + +FOBI_FAIL_ON_MISSING_FORM_HANDLER_PLUGINS = True +FOBI_FAIL_ON_MISSING_FORM_WIZARD_HANDLER_PLUGINS = True +FOBI_FAIL_ON_ERRORS_IN_FORM_ELEMENT_PLUGINS = False +# FOBI_FAIL_ON_ERRORS_IN_FORM_HANDLER_PLUGINS = True +FOBI_FAIL_ON_ERRORS_IN_FORM_WIZARD_HANDLER_PLUGINS = True + +# WAIT_BETWEEN_TEST_STEPS = 0 +# FOBI_WAIT_AT_TEST_END = 0 +MAILCHIMP_API_KEY = '186eee04b7eae9b1d9bb61b402c37e52-us7' + + +ENABLE_CAPTCHA = True + +# LANGUAGE_CODE = 'nl' + +RECAPTCHA_PUBLIC_KEY = '6LdSp_8SAAAAAC1Q4ZvbvB9wOfCc92o9EGEcRMpp' +RECAPTCHA_PRIVATE_KEY = '6LdSp_8SAAAAAAxdzw2U6i3Q46jltXoiSEXAk5wL' + +# from fobi.constants import ( +# SUBMIT_VALUE_AS_VAL, SUBMIT_VALUE_AS_REPR, SUBMIT_VALUE_AS_MIX +# ) +# SUBMIT_VALUE_AS = SUBMIT_VALUE_AS_MIX +# +# FOBI_FORM_ELEMENT_RADIO_SUBMIT_VALUE_AS = SUBMIT_VALUE_AS #'val' +# FOBI_FORM_ELEMENT_SELECT_SUBMIT_VALUE_AS = SUBMIT_VALUE_AS #'val' +# FOBI_FORM_ELEMENT_SELECT_MULTIPLE_SUBMIT_VALUE_AS = SUBMIT_VALUE_AS #'val' +# 'val' +# FOBI_FORM_ELEMENT_SELECT_MODEL_OBJECT_SUBMIT_VALUE_AS = SUBMIT_VALUE_AS +# FOBI_FORM_ELEMENT_SELECT_MULTIPLE_MODEL_OBJECTS_SUBMIT_VALUE_AS = \ +# SUBMIT_VALUE_AS + +from selenium import webdriver +CHROME_DRIVER_OPTIONS = webdriver.ChromeOptions() +CHROME_DRIVER_OPTIONS.add_argument('-headless') +CHROME_DRIVER_OPTIONS.add_argument('-no-sandbox') +CHROME_DRIVER_OPTIONS.set_capability('chrome.binary', "/usr/bin/google-chrome") + +# CHROME_DRIVER_OPTIONS.add_argument('-single-process') + +from chromedriver_py import binary_path +CHROME_DRIVER_EXECUTABLE_PATH = binary_path # '/usr/bin/chromedriver' +# CHROME_DRIVER_EXECUTABLE_PATH = None +FIREFOX_BIN_PATH = '/usr/lib/firefox/firefox' +FIREFOX_BIN_PATH = None +PHANTOM_JS_EXECUTABLE_PATH = '' +# PHANTOM_JS_EXECUTABLE_PATH = None + +os.environ.setdefault( + 'FOBI_SOURCE_PATH', + '/home/delusionalinsanity/bbrepos/django-fobi/src' +) + +DEBUG_TEMPLATE = True + +# DATABASES = { +# 'default': { +# 'ENGINE': 'djongo', +# 'NAME': 'your-db-name', +# } +# } + +FOBI_PLUGIN_INVISIBLE_RECAPTCHA_SITE_KEY = \ + '6Lcya0EUAAAAAHfpe9JSmvdy0Ie9SIOtX0Abdn_v' +FOBI_PLUGIN_INVISIBLE_RECAPTCHA_SITE_SECRET = \ + '6Lcya0EUAAAAAJQKcPYlOQwghvwaRvShwCrgyU12' + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'root': { + 'level': 'INFO', + 'handlers': ['all_log'], + }, + 'formatters': { + 'verbose': { + 'format': '\n%(levelname)s %(asctime)s [%(pathname)s:%(lineno)s] ' + '%(message)s' + }, + 'simple': { + 'format': '\n%(levelname)s %(message)s' + }, + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + }, + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + 'formatter': 'verbose' + }, + 'all_log': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': PROJECT_DIR("../../logs/all.log"), + 'maxBytes': 1048576, + 'backupCount': 99, + 'formatter': 'verbose', + }, + 'django_log': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': PROJECT_DIR("../../logs/django.log"), + 'maxBytes': 1048576, + 'backupCount': 99, + 'formatter': 'verbose', + }, + 'django_request_log': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': PROJECT_DIR("../../logs/django_request.log"), + 'maxBytes': 1048576, + 'backupCount': 99, + 'formatter': 'verbose', + }, + 'fobi_log': { + 'level': 'DEBUG', + 'class': 'logging.handlers.RotatingFileHandler', + 'filename': PROJECT_DIR("../../logs/fobi.log"), + 'maxBytes': 1048576, + 'backupCount': 99, + 'formatter': 'verbose', + }, + }, + 'loggers': { + 'django.request': { + 'handlers': ['django_request_log'], + 'level': 'INFO', + 'propagate': True, + }, + 'django': { + 'handlers': ['django_log'], + 'level': 'ERROR', + 'propagate': False, + }, + 'fobi': { + 'handlers': ['console', 'fobi_log'], + 'level': 'DEBUG', + 'propagate': True, + }, + 'django.db': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': False, + }, + }, +} \ No newline at end of file diff --git a/examples/simple/settings/test.py b/examples/simple/settings/test.py index 9f53205b..9d2de792 100644 --- a/examples/simple/settings/test.py +++ b/examples/simple/settings/test.py @@ -14,7 +14,7 @@ DEBUG_TOOLBAR = False DATABASES = { 'default': { # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'fobi', 'USER': 'postgres', 'PASSWORD': 'test', @@ -26,19 +26,16 @@ DATABASES = { # Empty for localhost through domain sockets or '127.0.0.1' for # localhost through TCP. - 'HOST': '', - # Set to empty string for default. - 'PORT': '', + 'HOST': 'localhost', 'TEST': { + 'HOST': 'localhost', 'NAME': 'fobi_tests', 'USER': 'postgres', - 'PASSWORD': '', # For travis + 'PASSWORD': 'test', } } } -DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql' - # FeinCMS addons INSTALLED_APPS += [ diff --git a/scripts/create_dirs.sh b/scripts/create_dirs.sh new file mode 100755 index 00000000..78c57470 --- /dev/null +++ b/scripts/create_dirs.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +mkdir -p examples/logs/ +mkdir -p examples/db/ +mkdir -p examples/tmp/ +mkdir -p var/ diff --git a/scripts/create_superuser.sh b/scripts/create_superuser.sh new file mode 100755 index 00000000..2320595e --- /dev/null +++ b/scripts/create_superuser.sh @@ -0,0 +1,3 @@ +cd examples/simple/ +./manage.py createsuperuser + diff --git a/setup.py b/setup.py index 5d6d8ac9..e14682f7 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ import os from distutils.version import LooseVersion from setuptools import setup, find_packages -version = '0.17.1' +version = '0.18.1' # *************************************************************************** # ************************** Django version ********************************* @@ -275,6 +275,7 @@ setup( "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Environment :: Web Environment", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "License :: OSI Approved :: GNU Lesser General Public License v2 or "