Giter Site home page Giter Site logo

Comments (6)

timothyshaw avatar timothyshaw commented on June 4, 2024

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.

bernardopires avatar bernardopires commented on June 4, 2024

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.

timothyshaw avatar timothyshaw commented on June 4, 2024

Thanks Bernardo!

from django-tenant-schemas.

bernardopires avatar bernardopires commented on June 4, 2024

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.

timothyshaw avatar timothyshaw commented on June 4, 2024

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.

bernardopires avatar bernardopires commented on June 4, 2024

The test cases should now emulate pretty well a real environment with tenant schemas.

from django-tenant-schemas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.