如何运行现有的Django文件?
我以Django项目的形式下载了一个带有多个Python文件的文件夹,我无法运行它。通常,当您创建一个django项目时,它将在终端中创建使用行django-admin startproject web_project。
Python Manage.py Runserver
启动服务器。
如何启动服务器运行我的项目?
当我使用django-admin startproject web_project。
时,它会创建一个我不需要的新项目。当我使用python manage.py迁移
或python manage.py runserver
它说:
Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3
但是,即使我使用python3 manage.py migrate.py migrate
或<代码> python3 manage.py runserver ,然后返回:
python3: can't open file 'manage.py': [Errno 2] No such file or directory
I downloaded a folder with multiple python files in the form of a Django project for a course and I am unable to run it. Usually, when you create a Django project it is created within the terminal with the line django-admin startproject web_project .
and then python manage.py migrate
is used and then the line python manage.py runserver
to start a server.
How do I start a server to run my project?
When I use django-admin startproject web_project .
, it creates a new project which I don't want. When I use python manage.py migrate
or python manage.py runserver
it says:
Command 'python' not found, did you mean:
command 'python3' from deb python3
command 'python' from deb python-is-python3
But even when I used python3 manage.py migrate
or python3 manage.py runserver
instead and it returned:
python3: can't open file 'manage.py': [Errno 2] No such file or directory
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,请确保在运行RunServer命令时,在正确目录(在Projects Directory中)打开命令提示符或终端。
如果您在Windows上打开项目文件夹(包含Manage.py之类的文件的文件夹),请右键单击并在此处按Open PowerShell窗口。
At first make sure you opened command prompt or terminal in right directory(in projects directory) when you are running the runserver command.
If you are on windows open the project folder(the folder that contains files like manage.py), then right click and press open PowerShell window here.
首先,我建议使用以下命令创建虚拟环境,
然后激活它
源.env/bin/activate
“ django-admin statproject”用于Initalite一个新的项目,用于运行激动的Django应用程序,您应该只安装Django(如果现在有“ unignts.txt” file.txt”文件 - ,迁移和运行。
first of all I recommend creating a virtual environment using the following command
then activate it
source .env/bin/activate
"django-admin statproject" its for initalite a new project for running an excited Django app you should just install Django - if there is now "requirements.txt" file- , migrate and run.