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

Coursera学Python后尝试Django全新安装,runserver报Traceback求助

Troubleshooting Django runserver Traceback Error (Windows 10, Python 3.6, Django 2.0.2)

Hey there, let’s work through this runserver issue you’re hitting while practicing Python from your Coursera specialization. Since reinstalling Django didn’t fix things, here are some targeted steps to diagnose and resolve the problem:

  • Verify your environment setup
    First, double-check that you’re working in the correct Python environment. Run python --version to confirm it’s 3.6, then pip list to ensure Django 2.0.2 is installed in that environment. If you’re using a virtual environment, make sure it’s activated properly (on Windows, that’s venv\Scripts\activate in your project directory).

  • Confirm your working directory
    Make sure you’re running the runserver command from the root directory of your Django project—the same folder that contains manage.py. If you’re in a subfolder, Django won’t find the necessary configuration files, leading to a traceback.

  • Dig into the exact traceback details
    The traceback message holds critical clues! For example, if it’s a ModuleNotFoundError, you might be missing a project dependency (not just Django). If it’s an import error related to your project’s settings, check settings.py for typos or missing configurations. Even noting the last line of the error can help narrow things down.

  • Clear cached files
    Corrupted .pyc files or cache directories can cause unexpected errors. Delete any __pycache__ folders in your project and virtual environment, then try running python manage.py runserver again.

  • Test with a fresh Django project
    To rule out project-specific issues, create a new test project with:

    django-admin startproject test_project
    cd test_project
    python manage.py runserver
    

    If this works, your original project likely has a corrupted file (like a misconfigured settings.py or missing app) that needs fixing.

  • Specify the Python version explicitly
    On Windows, multiple Python versions can sometimes conflict. Try running the server with the exact Python 3.6 executable:

    py -3.6 manage.py runserver
    

Let me know if any of these steps resolve the issue, or if you can share the full traceback message—we can narrow it down further!

内容的提问来源于stack exchange,提问作者Anders Erixon

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 10:26:56