From c674efa9c86f44bdd20175a0cdd3cf19771557e2 Mon Sep 17 00:00:00 2001 From: Hugo Bessa Date: Mon, 31 May 2021 22:06:56 -0300 Subject: [PATCH 1/3] updates python, django and postgres support --- .travis.yml | 11 ++++++----- README.rst | 3 ++- docs/use.rst | 2 +- setup.py | 9 +++++---- .../management/commands/migrate_schemas.py | 1 + tox.ini | 17 ++++++----------- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index 474306f..4b8d180 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ cache: pip python: - 3.6 - 3.7 + - 3.8 + - 3.9 matrix: fast_finish: true @@ -12,7 +14,7 @@ services: - postgresql addons: - postgresql: "9.6" + postgresql: "12.7" install: - pip install -q tox-travis @@ -24,11 +26,9 @@ script: - tox env: - - DJANGO=1.11 - - DJANGO=2.0 - - DJANGO=2.1 - DJANGO=2.2 - - DJANGO=3.0 + - DJANGO=3.1 + - DJANGO=3.2 deploy: provider: pypi @@ -40,3 +40,4 @@ deploy: repo: vintasoftware/django-pg-tenants tags: true skip_existing: true + skip_cleanup: true diff --git a/README.rst b/README.rst index 8e4fd7a..cc05c8a 100644 --- a/README.rst +++ b/README.rst @@ -3,7 +3,7 @@ django-pg-tenants |PyPi version| |PyPi downloads| |Python versions| |Travis CI| |PostgreSQL| -This is a fork of [django-tenant-schemas](https://github.com/bernardopires/django-tenant-schemas). +This is a fork of `django-tenant-schemas`_. This application enables `django`_ powered websites to have multiple tenants via `PostgreSQL schemas`_. A vital feature for every @@ -197,6 +197,7 @@ tenant specific apps. Complete instructions can be found at +.. _django-tenant-schemas: https://github.com/bernardopires/django-tenant-schemas .. _django: https://www.djangoproject.com/ .. _PostgreSQL schemas: http://www.postgresql.org/docs/9.1/static/ddl-schemas.html .. _PostgreSQL's official documentation on schemas: http://www.postgresql.org/docs/9.1/static/ddl-schemas.html diff --git a/docs/use.rst b/docs/use.rst index d8ee5a0..2e91ad9 100644 --- a/docs/use.rst +++ b/docs/use.rst @@ -6,7 +6,7 @@ Supported versions ------------------ You can use ``django-pg-tenants`` with currently maintained versions of Django -- see the `Django's release process `_ and the present list of `Supported Versions `_. -It is necessary to use a PostgreSQL database. ``django-pg-tenants`` will ensure compatibility with the minimum required version of the latest Django release. At this time that is PostgreSQL 9.3, the minimum for Django 1.11. +It is necessary to use a PostgreSQL database. ``django-pg-tenants`` will ensure compatibility with the minimum required version of the latest Django release. At this time that is PostgreSQL 12.7, the minimum for Django 2.2. Creating a Tenant ----------------- diff --git a/setup.py b/setup.py index e622712..b081856 100755 --- a/setup.py +++ b/setup.py @@ -24,17 +24,18 @@ classifiers=[ "License :: OSI Approved :: MIT License", "Framework :: Django", - "Framework :: Django :: 1.11", - "Framework :: Django :: 2.0", - "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", + "Framework :: Django :: 3.1", + "Framework :: Django :: 3.2", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: Database", "Topic :: Software Development :: Libraries", ], - install_requires=["Django>=1.11", "ordered-set", "psycopg2-binary", "six"], + install_requires=["Django>=2.2", "ordered-set", "psycopg2-binary", "six"], setup_requires=["setuptools-scm"], use_scm_version=True, zip_safe=False, diff --git a/tenant_schemas/management/commands/migrate_schemas.py b/tenant_schemas/management/commands/migrate_schemas.py index 3dc9d87..e6db4ce 100644 --- a/tenant_schemas/management/commands/migrate_schemas.py +++ b/tenant_schemas/management/commands/migrate_schemas.py @@ -10,6 +10,7 @@ class Command(SyncCommon): + requires_system_checks = [] help = ( "Updates database schema. Manages both apps with migrations and those without." ) diff --git a/tox.ini b/tox.ini index a81bbee..a4c41d0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,13 @@ [tox] envlist = - py{36,37}-dj{111,20,21,22,30}-{standard,parallel} + py{36,37,38,39}-dj{22,31,32}-{standard,parallel} skip_missing_interpreters = true [travis:env] DJANGO = - 1.11: dj111-{standard,parallel} - 2.0: dj20-{standard,parallel} - 2.1: dj21-{standard,parallel} 2.2: dj22-{standard,parallel} - 3.0: dj30-{standard,parallel} + 3.1: dj31-{standard,parallel} + 3.2: dj32-{standard,parallel} [testenv] usedevelop = true @@ -18,15 +16,12 @@ deps = coverage mock tblib - dj111: Django>=1.11a1,<2.0 - dj20: Django>=2.0a1,<2.1 - dj21: Django>=2.1a1,<2.2 dj22: Django>=2.2a1,<3.0 - dj30: Django>=3.0a1,<3.1 + dj31: Django>=3.1a1,<3.2 + dj32: Django>=3.2a1,<3.3 docker = - pg96: postgres:9.6 - pg100: postgres:10 + pg120: postgres:12 dockerenv = POSTGRES_USER=dpt_test_project POSTGRES_PASSWORD=dpt_test_project From 1ae463587fed695380ff09876ad106d7324513e6 Mon Sep 17 00:00:00 2001 From: Hugo Bessa Date: Mon, 31 May 2021 22:29:18 -0300 Subject: [PATCH 2/3] Fixes postgrest configuration on Travis --- .travis.yml | 20 ++++++++++++++----- dpt_test_project/dpt_test_project/settings.py | 10 +++++----- tox.ini | 2 +- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4b8d180..c558843 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,21 +14,31 @@ services: - postgresql addons: - postgresql: "12.7" + postgresql: "12" + apt: + packages: + - postgresql-12 + - postgresql-client-12 + - postgresql-server-dev-12 + install: - pip install -q tox-travis before_script: - - psql -c "CREATE DATABASE dpt_test_project;" -U postgres + - psql -c "CREATE DATABASE dpt_test_project;" -U travis script: - tox env: - - DJANGO=2.2 - - DJANGO=3.1 - - DJANGO=3.2 + global: + - PGPORT=5433 + - PGUSER=travis + jobs: + - DJANGO=22 + - DJANGO=31 + - DJANGO=32 deploy: provider: pypi diff --git a/dpt_test_project/dpt_test_project/settings.py b/dpt_test_project/dpt_test_project/settings.py index b0bb514..af1b9eb 100644 --- a/dpt_test_project/dpt_test_project/settings.py +++ b/dpt_test_project/dpt_test_project/settings.py @@ -65,11 +65,11 @@ DATABASES = { "default": { "ENGINE": "tenant_schemas.postgresql_backend", - "NAME": os.environ.get("PG_NAME", "dpt_test_project"), - "USER": os.environ.get("PG_USER"), - "PASSWORD": os.environ.get("PG_PASSWORD"), - "HOST": os.environ.get("PG_HOST"), - "PORT": int(os.environ.get("PG_PORT")) if os.environ.get("PG_PORT") else None, + "NAME": os.environ.get("PGNAME", "dpt_test_project"), + "USER": os.environ.get("PGUSER"), + "PASSWORD": os.environ.get("PGPASSWORD"), + "HOST": os.environ.get("PGHOST"), + "PORT": int(os.environ.get("PGPORT")) if os.environ.get("PG PORT") else None, } } diff --git a/tox.ini b/tox.ini index a4c41d0..7bbad23 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,7 @@ dockerenv = changedir = dpt_test_project -passenv = PG_NAME PG_USER PG_PASSWORD PG_HOST PG_PORT +passenv = PGNAME PGUSER PGPASSWORD PGHOST PGPORT setenv = standard: MIGRATION_EXECUTOR=standard From d5cdcfecb2f09966fa33ba89442eec0e4782c0b9 Mon Sep 17 00:00:00 2001 From: Hugo Bessa Date: Mon, 31 May 2021 22:46:18 -0300 Subject: [PATCH 3/3] Updates posgres support on docs --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index cc05c8a..f6a98aa 100644 --- a/README.rst +++ b/README.rst @@ -210,6 +210,6 @@ tenant specific apps. Complete instructions can be found at .. |Python versions| image:: https://img.shields.io/pypi/pyversions/django-pg-tenants.svg .. |Travis CI| image:: https://travis-ci.org/vintasoftware/django-pg-tenants.svg?branch=master :target: https://travis-ci.org/vintasoftware/django-pg-tenants -.. |PostgreSQL| image:: https://img.shields.io/badge/PostgreSQL-9.2%2C%209.3%2C%209.4%2C%209.5%2C%209.6-blue.svg +.. |PostgreSQL| image:: https://img.shields.io/badge/PostgreSQL-12.7-blue.svg .. _setup: https://django-pg-tenants.readthedocs.io/en/latest/install.html .. _django-pg-tenants.readthedocs.io: https://django-pg-tenants.readthedocs.io/en/latest/