Comments (6)
This is my setup:
SHARED_APPS = (
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.contenttypes',
'django.contrib.admin',
'south',
'tenant_schemas',
'apps.customer',
)
TENANT_APPS = (
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.contenttypes',
'django.contrib.admin',
'crispy_forms',
'dropbox',
'sorl.thumbnail',
'south',
'apps.ad',
'apps.contract',
'apps.install',
'apps.materials',
'apps.payment',
'apps.schedule',
'apps.settings',
'apps.site',
'tenant_addons',
'utils',
)
INSTALLED_APPS = SHARED_APPS + TENANT_APPS
from django-tenant-schemas.
Hi Timothy,
I'm kinda of busy right now but I'll promise I'll look into this as soon as
possible. At most on sunday you should have a reply. Thanks for all the
help!
Cheers,
Bernardo
2013/8/9 timothyshaw [email protected]
This is my setup:
SHARED_APPS = (
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.contenttypes',
'django.contrib.admin','south', 'tenant_schemas', 'apps.customer',
)
TENANT_APPS = (
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.contenttypes',
'django.contrib.admin','crispy_forms', 'dropbox', 'sorl.thumbnail', 'south', 'apps.ad', 'apps.contract', 'apps.install', 'apps.materials', 'apps.payment', 'apps.schedule', 'apps.settings', 'apps.site', 'tenant_addons', 'utils',
)
INSTALLED_APPS = SHARED_APPS + TENANT_APPS
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/57#issuecomment-22364569
.
Bernardo Pires Carneiro
from django-tenant-schemas.
Thanks Bernardo!
from django-tenant-schemas.
Hi Timothy,
I'm sorry the tests turned out confusing! I assume that since you are talking about requests (POST, GET, etc) the tests you refer to are the ones in routes.py, correct? Anyways, you were indeed correct that the tenant wasn't being created here. When I wrote those tests the public and tenant schemas had to contain exactly the same tables and therefore there was no difference where the test was running. This is no longer the case and it turns out the test was a little outdated. The fix is to set settings.TENANT_APPS
just like you pointed out, I've already pushed the new code, thanks! (On a sidenote I'd like to mention this had no impact on the routes.py tests, as basically only the middleware is being tested and it only checks the tenants table on the public schema)
Now, I'm not sure if you saw the other tests in tenants.py, which I consider a little more important. I remember fixing these tests because they started to fail when the new settings TENANT_APPS and PUBLIC_APPS came out (that is, when tenant schemas could now have different tables than the public schema). These tests already create tenants and you should be able to halt the test and see the schemas being created.
It would be nice to have a test to check if the PUBLIC_APPS models are being synced to the public schema and if the TENANT_APPS are being synced to the tenant schemas, but I haven't had the time for that.
I hope I've answered some of your doubts! I think the tests themselves are pretty self-explanatory, but don't hesitate on asking any questions you want! Thanks for the help!
Cheers,
Bernardo
from django-tenant-schemas.
Thanks for the reply Bernardo. I checked out those tests and gleaned some insight from them.
However, what I was referring to were the tools located in tenant_schemas/test/. The cases.py and client.py. Sorry for the confusion.
I spent a number of hours looking things over and finally feel I gained a good understanding of what is happening. I'm currently too busy to go into it in detail, but will come back here soon to let you know what I'm experiencing.
Basically, the unit testing tools this project provides (not the unit tests for the project itself) could be improved by more closely emulating the customized Django environment with tenant schemas. The Django test runner sets up the database differently from how one would do it following your instructions.
I'll be back soon. Thanks!
from django-tenant-schemas.
The test cases should now emulate pretty well a real environment with tenant schemas.
from django-tenant-schemas.
Related Issues (20)
- Can't migrate new tables to tennant apps.
- New tenant model is not creating relations in non-public schema with multiple databases
- Accessing tenants data from public. HOT 1
- django-tenants TypeError: argument of type 'TenantQueryset' is not iterable
- ImportError: cannot import name 'force_text' from 'django.utils.encoding' HOT 3
- How to create tenant_schemas.storage.TenantFileSystemStorage within AWS s3 bucket with django-storages 1.12.3
- "Apps aren't loaded yet" when upgrading from django 3.0.10 to 3.2
- Schema Deletion HOT 1
- DRF example
- Support for django 4.0 HOT 7
- how to launch tenant_command loaddata from views with fixtures HOT 1
- Supported Version Django HOT 3
- Distinguish between workspaces
- error 500 DEBUG=False in production HOT 1
- [Solution] Unable to create the django_migrations -relation already exists HOT 1
- healthcheck HOT 2
- Issue in holding DB connection consistently HOT 1
- @contextmanager
- Django-tenants - please help
- About changing public schema to other schema. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-tenant-schemas.