Answer the question
In order to leave comments, you need to log in
Why doesn't Heroku see the migrations it created?
Heroku creates migrations but doesn't see them while applying!
After the deployment, I applied the command: $ heroku run python manage.py migrate
But as it turned out, it created only the system tables of connected modules, but did not create the model tables that I described in the application ( stats/models.py ).
I tried migrations by explicitly specifying the application in the command. The result is discouraging:
$ heroku run python manage.py makemigrations stats
Running python manage.py makemigrations stats on ⬢ myapp... up, run.8388 (Free)
Migrations for 'stats':
stats/migrations/0001_initial.py
- Create model AuthUser
- Create model SocialAuthUserSocialAuth
- Create model Task
- Create model User
$ heroku run python manage.py migrate stats
Running python manage.py migrate stats on ⬢ myapp... up, run.4095 (Free)
CommandError: App 'stats' does not have migrations.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'stats.apps.StatsConfig',
'rest_framework',
'social_django'
]
class User(models.Model):
fullname = models.CharField(max_length=200, default='')
uid = models.CharField(max_length=200, default='')
nickname = models.CharField(max_length=200, default='')
extra_token = models.CharField(max_length=200, default='')
token_got = models.DateTimeField('date token got', default=datetime.now)
def __str__(self):
return self.fullname
class Meta:
db_table = 'stats_user'
class Task(models.Model):
nickname = models.CharField(max_length=200, default='')
busy = models.BooleanField(default=False)
# Модели ниже изначально были получены командой python manage.py inspectdb
# и связаны с библиотекой social_django. У меня была необходимость делать запросы туда.
# На всякий случай я это пишу, но сам думаю, что это не может быть причиной моей проблемы.
# Ведь локально все норм.
class AuthUser(models.Model):
password = models.CharField(max_length=128)
last_login = models.DateTimeField(blank=True, null=True)
is_superuser = models.BooleanField()
username = models.CharField(unique=True, max_length=150)
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=150)
email = models.CharField(max_length=254)
is_staff = models.BooleanField()
is_active = models.BooleanField()
date_joined = models.DateTimeField()
class Meta:
managed = False
db_table = 'auth_user'
class SocialAuthUserSocialAuth(models.Model):
provider = models.CharField(max_length=32)
uid = models.CharField(max_length=255)
extra_data = models.TextField() # This field type is a guess.
user = models.ForeignKey(AuthUser, models.DO_NOTHING)
class Meta:
managed = False
db_table = 'social_auth_usersocialauth'
unique_together = (('provider', 'uid'),)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question