如何运行现有的Django文件?

发布于 2025-02-12 03:16:46 字数 726 浏览 0 评论 0原文

我以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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

拧巴小姐 2025-02-19 03:16:47

首先,请确保在运行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.

時窥 2025-02-19 03:16:47

首先,我建议使用以下命令创建虚拟环境,

python3 -m venv .env

然后激活它
源.env/bin/activate
“ django-admin statproject”用于Initalite一个新的项目,用于运行激动的Django应用程序,您应该只安装Django(如果现在有“ unignts.txt” file.txt”文件 - ,迁移和运行。

pip install Django
python manage.py migrate
python manage.py runserver

first of all I recommend creating a virtual environment using the following command

python3 -m venv .env

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.

pip install Django
python manage.py migrate
python manage.py runserver
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文