2
I need to configure my Django to run llb django-tenant-schema
My project does not create schemas and soon I cannot synchronize my bank with the project.
I’m having trouble understanding how you are llb
works and how I should configure it, since I tried to configure it based on the tutorials of the own llb
. Any hint of what’s missing?!
- My database is already structured. (Postgressql)
- Man project is almost ready (Just a few adjustments after finishing this part).
- Model of schema is also already ready.
- If applicable, should use
django-tenants
? Seems very similar...
I wonder if how I am configuring it is correct, because in my view I am doing it wrong. Even when trying to create data to test is not working as it should.
This is my py Settings.:
SHARED_APPS = (
'tenant_schemas', # mandatory, should always be before any django app
'dash', # you must list the app where your tenant model resides in
'django.contrib.contenttypes',
# everything below here is optional
# 'django.contrib.auth',
# 'django.contrib.sessions',
# 'django.contrib.sites',
# 'django.contrib.messages',
# 'django.contrib.admin',
)
TENANT_APPS = (
'django.contrib.contenttypes',
# your tenant-specific apps
'dash',
)
INSTALLED_APPS = [
'tenant_schemas', # mandatory, should always be before any django app
'dash',
'django.contrib.contenttypes',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'widget_tweaks',
'login',
'api',
'correlator', # Nome do projeto
]
TENANT_MODEL = "login.LoginBd" # app.Model
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
DATABASE_ROUTERS = ('tenant_schemas.routers.TenantSyncRouter',)
DATABASES = {
'default': {
'ENGINE': 'tenant_schemas.postgresql_backend', # O resto que não está aqui é desnecessario
Structure of the Project is like this:
Loginbd must have auto_create_schema = True
?
Should I set up something else in the templates? settings.p
y is configured correctly? How do I enter new schemas? And test data?
On the Django-tenant-schema website I saw something that would be like TENANT_MODEL_DOMAIN
. Should I use? If yes, how?
Sorry if I’m rude but, you don’t think if I created a post on stackoverflow I haven’t read the documentation at least 10 times and tried everything I think I can? Where do you think I got the name from the library? If you had opened the same link you sent, you would realize that I am trying to set up the way they explain, but without success...
– Nicolas
No problem but your question is how to set up and in the documentation already has how to do, if you are having some error you should detail so that other people who are going to answer at least understand what your problem is, you must be forgetting something, try to look at the project issues if someone has the same problem and if nothing goes right do it all over again
– Davi Wesley
Of course, no problem I supplement the question, but so, what you answered is useless. I followed the steps (badly explained) of the library and did not get to work, who has knowledge about this library, will hit his eye in my code and will know what has to be done, and that is what this forum is for, to share knowledge.... And to state the obvious is not intelligent. Now if you had asked to supplement the question I would understand.
– Nicolas
I still do not have this privilege kkkk, has this article from Vinta that a company specialized in Django, they explain a solution that already has in Django https://www.vinta.com.br/blog/2017/multitenancy-juggling-customer-datadjango/
– Davi Wesley
I think you have confused things, in my view this is a way that they have created to do without Ilb, and I believe it is better to do via llb stable. But thanks just the same.
– Nicolas