Comments (13)
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.
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.
Possibly is my fault
from django-tenant-schemas.
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.
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.
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.
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.
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.
Perfect Bernardo!
from django-tenant-schemas.
I've updated the docs, please tell me if the issue isn't fixed
from django-tenant-schemas.
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.
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.
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)
- weird behaviour using "with schema_context" HOT 3
- 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
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.