需要在CMD命令行下先进入项目根目录,dir看看有没有manage.py这个文件,然后运行项目,Django安装配置之后必须runserver才能在本地访问,命令为:‘python manage.py runserver’,如果配置OK的话,会出现下面的提示,表示启动成功:
E:\workspace\python\CMS>python manage.py runserverPerforming system checks...
System check identified no issues (0 silenced).
May 17, 2017 - 08:37:14
Django version 1.11.1, using settings 'CMS.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
但是如果没有将Python数据导入到默认的数据库SQLite,会出现下面的提示:
E:\workspace\python\CMS>python manage.py runserverPerforming system checks...
System check identified no issues (0 silenced).
You have 13 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.
May 17, 2017 - 08:35:36
Django version 1.11.1, using settings 'CMS.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
提示信息中已经告诉你应该运行命令“python manage.py migrate”来创建数据库后,重新使用runserver的命令“python manage.py runserver”即可。
当然啦,您无法访问的原因也可能是其他的,如8000端口被占用等问题,可以百度相关问题来解决。
(完)
祝各位朋友身体健康,工作顺利!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)