创建并启动一个新的Django项目,显示:
Performing system checks...
System check identified no issues (0 silenced).
You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
July 18, 2023 - 13:36:29
Django version 4.0.4, using settings 'harrypotter.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
然后我用python manage.py migrate' to apply them解决了问题,但打开浏览器时显示127.0.0.1:8000拒绝访问
你执行完python manage.py migrate,再执行下python manage.py runserver
我推荐个django教程,B站上的,很多集:
网址:https://www.bilibili.com/video/BV1GN4y1w7LZ/?spm_id_from=333.337.search-card.all.click
能采纳一下吗
python manage.py dbshell
进到数据库中,执行delete from django_migrations where app='your_appname';
python manage.py makemigrations
(若migrations文件未删除,可不执行这一步)python manage.py migrate
好啦,大功告成