简体   繁体   English

manage.py runserver 无输出

[英]manage.py runserver no output

I've updated python 3.7 to 3.8 and after that when I want to run py manage.py runserver , or any other commands which are related to manage.py, I've got no output.我已将 python 3.7 更新为 3.8,之后当我想运行py manage.py runserver或与 manage.py 相关的任何其他命令时,我没有输出。 在此处输入图片说明

I read about environment variables and here is mine, which seems fine to me.我阅读了环境变量,这是我的,这对我来说似乎很好。 在此处输入图片说明

The problem was with the virtual environment.问题出在虚拟环境上。 I think because I changed my python version, now I have to create a virtual environment first otherwise py manage.py runserver will not work.我想是因为我改变了我的python版本,现在我必须先创建一个虚拟环境,否则py manage.py runserver将无法工作。 But, in previous version (3.7) I was able to do it without a virtual environment.但是,在以前的版本 (3.7) 中,我可以在没有虚拟环境的情况下做到这一点。

uninstall python and reinstall it (globally), means before installing select add path to system variable then select custom installation and select install for all users and install.卸载python并重新安装它(全局),意味着在安装之前选择将路径添加到系统变量然后选择自定义安装并选择为所有用户安装并安装。 now the python command will work, no need to use only py now.现在 python 命令可以工作了,现在不需要只使用 py 了。 and remember if you run visual code, only install system installer not user installer.请记住,如果您运行可视化代码,请只安装系统安装程序而不是用户安装程序。 after open vscode terminal and type:打开 vscode 终端并输入:

python -m django --version

to see django version.查看django版本。 then type然后输入

pip uninstall django

and enter.并进入。 it will uninstall django.它将卸载 Django。 now exit and goto现在退出并转到

C:\Users\(username)\AppData\Roaming\

path from file explorer and delete python folder, then goto文件资源管理器中的路径并删除python文件夹,然后转到

C:\Users\(username)\AppData\Local\

path from file explorer and delete pip folder.从文件资源管理器中删除路径并删除 pip 文件夹。 now run vs code as administrator and in terminal type现在以管理员身份和终端类型运行 vs 代码

pip install django

it will reinstall django(make sure it's not installing in它将重新安装 django(确保它没有安装在

C:\Users\(username)\AppData\Roaming\

now you can run the server globally without any problem.现在您可以毫无问题地全局运行服务器。

py -3.9 manage.py runserver

Trust me, I literally wasted around 4hrs because of that path issue and this one.相信我,由于路径问题和这个问题,我真的浪费了大约 4 小时。
I uninstalled everything and learned the whole process :P我卸载了所有东西并了解了整个过程:P

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM