Django刚从Django项目开始学习。 我正在尝试迁移,但它在终端显示“没有迁移要应用”,它应该显示“正在应用polls.0001_initial…”。。。好吧。” 我不知道我在哪里犯了错误,你能帮我吗? 谢谢您。在
[终点站]
Operations to perform:
Apply all migrations: admin, auth, contenttypes, polls, sessions
Running migrations:
No migrations to apply.
[我的网站/民意调查/模型.py]在
^{pr2}$[迁移/0001_初始.py]在
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Choice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('choice_text', models.CharField(max_length=200)),
('votes', models.IntegerField(default=0)),
],
),
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('question_text', models.CharField(max_length=200)),
('pub_date', models.DateTimeField(verbose_name='date published')),
],
),
migrations.AddField(
model_name='choice',
name='question',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='polls.Question'),
),
]
https://docs.djangoproject.com/en/2.1/intro/tutorial02/
我在使用python3.7.2和anaconda。在
听起来可能很傻,但你刷新了你的应用程序吗?我的意思是:在VSCode的文件侧栏上,你可以右键单击并选择刷新,或者单击createfile选项卡上的refresh选项卡。我以前没有让它显示我的新迁移,必须刷新才能看到它们。在
相关问题 更多 >
编程相关推荐