我得到的錯誤:如何使用新表遷移heroku上的本地數據庫?
Exception Value:
no such table: hello_surname
當我試圖證明訪問姓模式
在我的models.py視圖
class Surname(models.Model):
created = models.DateTimeField('date created', auto_now_add=True)
name = models.CharField(max_length=35)
我試圖運行遷移$ heroku run python manage.py migrate
輸出:
Running python manage.py migrate on ⬢ sleepy-fjord... up, run.7027
Operations to perform:
Apply all migrations: sessions, auth, hello, contenttypes, admin
Running migrations:
No migrations to apply.
Your models have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
然後我運行$ heroku run python manage.py makemigrations
輸出:
Running python manage.py makemigrations on ⬢ sleepy-fjord... up, run.8567
Migrations for 'hello':
0002_surname.py:
- Create model Surname
當我再次運行頂部遷移,它只是提供了輸出,當我跑了它的第一次相同。好像我在這裏錯過了一個步驟,但輸出我似乎無法自己弄清楚。任何人都知道解決方案
./manage.py makemigrations myappname – e4c5
所以你的意思是說當你在'$ heroku運行python manage.py makemigrations'後執行'$ heroku運行python manage.py migrate'時,你仍然會得到** No migrations to應用**以及**您的模型的變化尚未反映在遷移中,因此不會被應用。或者只是**沒有遷移申請** ?? –