Giter Club home page Giter Club logo

Comments (13)

bernardopires avatar bernardopires commented on June 16, 2024

Hi tsalaet,

sorry, my bad, I'm such a newbie with Pypi. Upgrade the repo with pip and everything should be working now, thanks for sending this issue in!

Bernardo

from django-tenant-schemas.

tsalaet avatar tsalaet commented on June 16, 2024

Hi Bernador

Now runs perfectly , but another some issue

=== Running syncdb for schema public
Creating tables ...
Installing custom SQL ...
Installing indexes ...
AttributeError: 'NoneType' object has no attribute 'objects'

from django-tenant-schemas.

tsalaet avatar tsalaet commented on June 16, 2024

Possibly is my fault

from django-tenant-schemas.

bernardopires avatar bernardopires commented on June 16, 2024

Hi Toni,

can you post your settings file here?

Bernardo

2013/3/3 Toni Salaet Larrull [email protected]

Hi Bernador

Now runs perfectly , but another some issue

=== Running syncdb for schema public
Creating tables ...
Installing custom SQL ...
Installing indexes ...
AttributeError: 'NoneType' object has no attribute 'objects'


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-14345987
.

Bernardo Pires Carneiro

from django-tenant-schemas.

tsalaet avatar tsalaet commented on June 16, 2024

It's my settings.py ,

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Your Name', '[email protected]'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'tenant_schemas.postgresql_backend',
'NAME': '__db', # Or path to database file if using sqlite3.
'USER': '*******', # Not used with sqlite3.
'PASSWORD': '
_
*****', # Not used with sqlite3.
'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '5432',

}

}

TIME_ZONE = 'America/Chicago'

LANGUAGE_CODE = 'en-us'

SITE_ID = 1

USE_I18N = True

USE_L10N = True

USE_TZ = True

MEDIA_ROOT = ''

MEDIA_URL = ''

STATIC_ROOT = ''

STATIC_URL = '/static/'

STATICFILES_DIRS = (

)

STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',

)

SECRET_KEY = '*************'

TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',

)

MIDDLEWARE_CLASSES = (
'tenant_schemas.middleware.TenantMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',

)

ROOT_URLCONF = '*******.urls'

WSGI_APPLICATION = '*******.wsgi.application'

TEMPLATE_DIRS = ('/home/toni/PycharmProjects/**********/templates',)

SHARED_APPS = (
'tenant_schemas',

'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.staticfiles',
'south',

)

TENANT_APPS = (

'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sites',




)

INSTALLED_APPS = SHARED_APPS + TENANT_APPS

SOUTH_DATABASE_ADAPTERS = {
'default': 'south.db.postgresql_psycopg2',
}

TENANT_MODEL = "Manager.Client" # app.Model

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}

Toni Salaet

from django-tenant-schemas.

bernardopires avatar bernardopires commented on June 16, 2024

I forgot to mention I'm also going to need your Manager.Client model code. So far I can't see anything wrong.

from django-tenant-schemas.

tsalaet avatar tsalaet commented on June 16, 2024

I'm trying with your code ..

from tenant_schemas.models import TenantMixin
from django.db import models

class Client(TenantMixin):
name = models.CharField(max_length=100)
paid_until = models.DateField()
on_trial = models.BooleanField()
created_on = models.DateField(auto_now_add=True)

# default true, schema will be automatically created and synced when it is saved
auto_create_schema = True

from django-tenant-schemas.

bernardopires avatar bernardopires commented on June 16, 2024

I've managed to reproduce your error and I'll update the docs with the correct information. Basically the problem is I forgot to mention in the docs that you need to include the app customer (in your case manager, I guess) at SHARED_APPS.

from django-tenant-schemas.

tsalaet avatar tsalaet commented on June 16, 2024

Perfect Bernardo!

from django-tenant-schemas.

bernardopires avatar bernardopires commented on June 16, 2024

I've updated the docs, please tell me if the issue isn't fixed

from django-tenant-schemas.

tsalaet avatar tsalaet commented on June 16, 2024

Sorry Bernardo for my delay.

Yes!, the issue is fixed. I had realised that if I upgrade with pip ,like "pip install --upgrade django-tenant-shcema" , django always upgrade I'm not sure if is correct but It's a minor problem.

If you need anymore ,Dont wait to tell it to me

Toni Salaet

from django-tenant-schemas.

pablo-rambles avatar pablo-rambles commented on June 16, 2024

Even though this is closed I will add another comment for completeness -

If you encounter the error:

  • AttributeError: 'NoneType' object has no attribute 'objects'

It could also be a symptom of your app structure. If your apps are located in a lower level - eg:

- project-name
      |-- apps
            |---- customers
            |---- another-app
- manage.py
- settings.py

Then you will have to take particular notice of the "TENANT_MODEL" setting - it is not a full path to your model (although the "SHARED_APPS" setting is a full path to your app). eg:

SHARED_APPS = (
    'tenant_schemas',  # mandatory
    'apps.customers',
)
TENANT_MODEL = "customers.Client"

In my case I had

SHARED_APPS = (
    'tenant_schemas',  # mandatory
    'apps.customers',
)
TENANT_MODEL = "apps.customers.Client"

which was causing the AttributeError.

@bernardopires - great app btw. Thanks for all your hard work

from django-tenant-schemas.

bernardopires avatar bernardopires commented on June 16, 2024

Thanks @pablo-rambles for your post and comments! I'm glad it helped you, let me know if you need anything.

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.