bernardopires / django-tenant-schemas

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

AttributeError: 'DatabaseWrapper' object has no attribute 'schema_name' #328

Closed ojengwa closed 8 years ago

ojengwa commented 8 years ago

I followed the example in the documentations but I get this error:

File "/Users/bernard/.virtualenvs/panda/lib/python2.7/site-packages/tenant_schemas/routers.py", line 21, in allow_migrate
    if connection.schema_name == get_public_schema_name():
  File "/Users/bernard/.virtualenvs/panda/lib/python2.7/site-packages/django/db/__init__.py", line 36, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
AttributeError: 'DatabaseWrapper' object has no attribute 'schema_name'

What could I be getting wrong, please? :)

mikicz commented 8 years ago

You need to update the database engine in the settings :)

ojengwa commented 8 years ago

Still having the same error. Here's my DB's default engine:

'ENGINE': 'django.db.backends.postgresql',

I am on Django 1.9.4. It was working before I added tenant_schemas.

mikicz commented 8 years ago

https://github.com/bernardopires/django-tenant-schemas/blob/master/examples/tenant_tutorial/tenant_tutorial/settings.py#L14

ojengwa commented 8 years ago

Thanks!!! @mikicz :)

mehemmelbachir commented 7 years ago

Hi guys, i have put the same settings as the tutorial 'ENGINE': 'tenant_schemas.postgresql_backend', but i still having the same error when trying to run _migrateschema --shared the error is: 'DatabaseWrapper' object has no attribute 'set_schema_to_public'

nicolasmendoza commented 6 years ago

@mehemmelbachir sure?, see please this tutorial and check if you have the correct settings: https://github.com/bernardopires/django-tenant-schemas/blob/master/examples/tenant_tutorial/tenant_tutorial/settings.py#L14