推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
callmebigfaceman
V2EX  ›  Python

django 2.2 导入自定义模块提示 ModuleNotFoundError: No module named?配置都是正确的,大佬指点一二。

  •  
  •   callmebigfaceman · Sep 21, 2020 · 2585 views
    This topic created in 2065 days ago, the information mentioned may be changed or developed.
    环境:
    pycharm 2018.1.4 professional
    django==2.2

    问题:
    新增 startapp App,但是当我引用它的时候,报错 ModuleNotFoundError: No module named
    setting 里面也注册了该 App
    4 replies    2020-09-22 17:37:05 +08:00
    blueaurora
        1
    blueaurora  
       Sep 21, 2020
    这个,应该是基本事情额,我 django3.0 没遇到这样的事情..楼主只能再仔细查一下了
    nonduality
        2
    nonduality  
       Sep 21, 2020
    这个是相对路径导入的问题,搜下 relative import
    callmebigfaceman
        3
    callmebigfaceman  
    OP
       Sep 22, 2020
    @blueaurora
    @nonduality
    谢谢大佬,我仔细查了,还是不知道问题在哪里。。
    nonduality
        4
    nonduality  
       Sep 22, 2020
    简单讲,你在 pycharm 里没设置好让 django 做相关的 setup,便会出 ModuleNotFoundError 。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1299 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 23:44 · PVG 07:44 · LAX 16:44 · JFK 19:44
    ♥ Do have faith in what you're doing.