Search code examples
djangodockerherokumulti-tenant

AttributeError: 'DatabaseWrapper' object has no attribute 'set_schema_to_public' (tenat_schemas)


I am using Django+tenant_schemas, and my local version of my app works fine. However, when I try to push it to staging (Heroku+Docker), I get the following error:

AttributeError: 'DatabaseWrapper' object has no attribute 'set_schema_to_public' (tenat_schemas).

The code points to:

tenant_schemas/middleware.py in process_request at line 46:

   connection.set_schema_to_public()

I can't figure out why I'm getting this error. Any advice will be greatly appreciated. Thanks


Solution

  • It's very difficult to answer this without more information, but the cause of your problem is probably that you're trying to use sqlite on Heroku. This error is thrown when you are trying to use the sqlite backend with the pgsql wrapper (or mysql). You should go through the configuration guide for Django apps on Heroku if you haven't already. If you post relevant sections from settings.py (with secrets removed, please!) and your Procfile it will be easier to give more help towards a solution.