Do you have a database router set up to tell Django which models are stored in which database?
Greetings, Remco Gerlich On Thu, Jun 9, 2016 at 2:13 PM, Galil <[email protected]> wrote: > Hello, > > I am using two databses for my Django app and one of them is an existing > MySQL database: > > DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.sqlite3', > 'NAME': os.path.join(BASE_DIR, 'users.sqlite3'), > }, > 'calls': { > 'ENGINE': 'django.db.backends.mysql', > 'NAME': 'portal2', > 'USER': 'cdraccess', > 'PASSWORD': '******', > 'HOST': '[MY_HOST]', > }, > > } > > > I used inspectdb to create the models for the call and they look like: > > class Calls(models.Model): > callid = models.AutoField(db_column='CallID', primary_key=True) # Field > name made lowercase. > conferencename = models.CharField(db_column='ConferenceName', max_length= > 200) # Field name made lowercase. > jointime = models.DateTimeField(db_column='JoinTime') # Field name made > lowercase. > leavetime = models.DateTimeField(db_column='LeaveTime', blank=True, null= > True) # Field name made lowercase. > > class Meta: > managed = True > db_table = 'ConferenceCall2' > > > I called makemigrations and then migrate and everything looks fine. > > However, when I run a query like Calls.objects.all() the result is: []. > > Or when I tried Calls..objects.count() the result was: 0. The MySQL database > is not empty, but apparently Django ORM believes that it is. > > Am I missing something? > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/c7052a27-e3ac-41fa-90a1-a1c266cd1c71%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/c7052a27-e3ac-41fa-90a1-a1c266cd1c71%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFAGLK2EU10QrxMdEUAVcwv7LYW7-_VvczPhFLakRWUE8Q7Ugg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

