You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

创建Django项目与应用后执行manage.py runserver遇文件未找到错误求助

Fixing the "can't open file 'manage.py'" Error in Django

Hey there, let’s get this sorted out right away. The issue here is super straightforward—you’re running the command from the wrong directory!

Why this happens

Your Django project structure should look something like this:

post_blog/
├── manage.py  # This is the file you’re missing!
├── post_blog/ (project config directory)
└── blogs/ (your app directory)

You’re currently in the blogs/ folder when you run python manage.py runserver, but manage.py lives one level up in the root post_blog/ directory. That’s why Python can’t locate it.

Step-by-step fixes

  • Option 1: Switch to the correct directory first
    In your command prompt or terminal, run this command to move up one level to the project root:

    cd ..
    

    Now you’re in C:\Users\arpchauh\PycharmProjects\post_blog\, and you can run the server normally:

    python manage.py runserver
    
  • Option 2: Run with the full path to manage.py
    If you don’t want to switch directories, you can specify the complete path to manage.py directly:

    python C:\Users\arpchauh\PycharmProjects\post_blog\manage.py runserver
    

Quick tip to avoid this in the future

Before running any Django management commands, always double-check that you’re in the directory containing manage.py. You can verify this by running:

dir  # For Windows
# OR
ls   # For Linux/macOS

This will list all files in your current directory—you should see manage.py listed if you’re in the right spot.

内容的提问来源于stack exchange,提问作者Arpit Chauhan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 08:01:25