Skip to content

Commit

Permalink
Merge pull request #2 from vintasoftware/update-django-support
Browse files Browse the repository at this point in the history
Update django support
  • Loading branch information
hugobessa authored Jun 1, 2021
2 parents 93fe9d8 + d5cdcfe commit 1c0f2cf
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 31 deletions.
25 changes: 18 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ cache: pip
python:
- 3.6
- 3.7
- 3.8
- 3.9

matrix:
fast_finish: true
Expand All @@ -12,23 +14,31 @@ services:
- postgresql

addons:
postgresql: "9.6"
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=1.11
- DJANGO=2.0
- DJANGO=2.1
- DJANGO=2.2
- DJANGO=3.0
global:
- PGPORT=5433
- PGUSER=travis
jobs:
- DJANGO=22
- DJANGO=31
- DJANGO=32

deploy:
provider: pypi
Expand All @@ -40,3 +50,4 @@ deploy:
repo: vintasoftware/django-pg-tenants
tags: true
skip_existing: true
skip_cleanup: true
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -209,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/
2 changes: 1 addition & 1 deletion docs/use.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Supported versions
------------------
You can use ``django-pg-tenants`` with currently maintained versions of Django -- see the `Django's release process <https://docs.djangoproject.com/en/1.11/internals/release-process/>`_ and the present list of `Supported Versions <https://www.djangoproject.com/download/#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
-----------------
Expand Down
10 changes: 5 additions & 5 deletions dpt_test_project/dpt_test_project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tenant_schemas/management/commands/migrate_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


class Command(SyncCommon):
requires_system_checks = []
help = (
"Updates database schema. Manages both apps with migrations and those without."
)
Expand Down
19 changes: 7 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,22 +16,19 @@ 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

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
Expand Down

0 comments on commit 1c0f2cf

Please sign in to comment.