bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.45k stars 425 forks source link

Support for django 4.0 #683

Open eliziario opened 2 years ago

humphrey commented 2 years ago

+1 In Django 3.2.x I get these deprecation warnings

# python -Wd manage.py check
/usr/local/lib/python3.8/site-packages/django/apps/registry.py:91: RemovedInDjango41Warning: 'tenant_schemas' defines default_app_config = 'tenant_schemas.apps.TenantSchemaConfig'. Django now detects this configuration automatically. You can remove default_app_config.
  app_config = AppConfig.create(entry)
/usr/local/lib/python3.8/site-packages/tenant_schemas/signals.py:3: RemovedInDjango40Warning: The providing_args argument is deprecated. As it is purely documentational, it has no replacement. If you rely on this argument as documentation, you can move the text to a code comment or docstring.
  post_schema_sync = Signal(providing_args=['tenant'])
System check identified no issues (0 silenced).
tobiasgoecke commented 2 years ago

from tenant_schemas.postgresql_backend.introspection import DatabaseSchemaIntrospection

File ".venv/lib/python3.8/site-packages/tenant_schemas/postgresql_backend/introspection.py", line 13, in from django.utils.encoding import force_text

from django.utils.encoding import force_text ImportError: cannot import name 'force_text' from 'django.utils.encoding'

replace "force_text" with "force_str"

kenytux commented 1 year ago

In Django 4.1.2 I get

from django.utils.encoding import force_text ImportError: cannot import name 'force_text' from 'django.utils.encoding' (/home/kenytux/.local/lib/python3.10/site-packages/django/utils/encoding.py errors)

When running the django-tenant-schemas/examples/tenant_tutorial

AustinGilkison commented 1 year ago

Have the same issue on Django 4.0.8 Django Cookiecutter.


  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 113, in load_backend
    return import_module("%s.base" % backend_name)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/site-packages/tenant_schemas/postgresql_backend/base.py", line 11, in <module>
    from tenant_schemas.postgresql_backend.introspection import DatabaseSchemaIntrospection
  File "/usr/local/lib/python3.9/site-packages/tenant_schemas/postgresql_backend/introspection.py", line 13, in <module>
    from django.utils.encoding import force_text
ImportError: cannot import name 'force_text' from 'django.utils.encoding' (/usr/local/lib/python3.9/site-packages/django/utils/encoding.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/manage.py", line 31, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 420, in execute
    django.setup()
  File "/usr/local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.9/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/usr/local/lib/python3.9/site-packages/django/apps/config.py", line 304, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "/usr/local/lib/python3.9/site-packages/django/contrib/auth/base_user.py", line 49, in <module>
    class AbstractBaseUser(models.Model):
  File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 141, in __new__
    new_class.add_to_class("_meta", Options(meta, app_label))
  File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 369, in add_to_class
    value.contribute_to_class(cls, name)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/options.py", line 235, in contribute_to_class
    self.db_table, connection.ops.max_name_length()
  File "/usr/local/lib/python3.9/site-packages/django/utils/connection.py", line 15, in __getattr__
    return getattr(self._connections[self._alias], item)
  File "/usr/local/lib/python3.9/site-packages/django/utils/connection.py", line 62, in __getitem__
    conn = self.create_connection(alias)
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 208, in create_connection
    backend = load_backend(db["ENGINE"])
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 126, in load_backend
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: 'tenant_schemas.postgresql_backend' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of:
    'mysql', 'oracle', 'postgresql', 'sqlite3'```
fegma59 commented 1 year ago

Abandoned project...

mast3rbow commented 1 year ago

Check out Django-tenants

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Felipe Guimarães @.> Sent: Saturday, November 5, 2022 9:01:22 AM To: bernardopires/django-tenant-schemas @.> Cc: Subscribed @.***> Subject: Re: [bernardopires/django-tenant-schemas] Support for django 4.0 (Issue #683)

Abandoned project...

— Reply to this email directly, view it on GitHubhttps://github.com/bernardopires/django-tenant-schemas/issues/683#issuecomment-1304323624, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AETWCMG33GDARTHHTXJJEETWGWIUFANCNFSM5TO4AJVQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

sandeepbol commented 1 year ago

If interested, please take a look at the following PR: https://github.com/bernardopires/django-tenant-schemas/pull/693