Answer the question
In order to leave comments, you need to log in
How to specify a database for saving a model?
There are 2 sites. Each of them has 2 databases for itself and there is another common one. There is only one table in total.
In the settings of each site, I specified a second base in addition to default:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
},
'registrations': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '../db.sqlite3'
}
}
class Registration(models.Model):
aa = models.CharField('fdg', name="fddf", max_length=10)
def __str__(self):
return self.aa
Answer the question
In order to leave comments, you need to log in
Routing register https://docs.djangoproject.com/en/3.2/topics/db/mu...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question