V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2020-09-21 14:13:14 +08:00 · 1737 次点击
    这是一个创建于 1313 天前的主题,其中的信息可能已经有所发展或是发生改变。
    环境:
    pycharm 2018.1.4 professional
    django==2.2

    问题:
    新增 startapp App,但是当我引用它的时候,报错 ModuleNotFoundError: No module named
    setting 里面也注册了该 App
    4 条回复    2020-09-22 17:37:05 +08:00
    blueaurora
        1
    blueaurora  
       2020-09-21 15:29:43 +08:00
    这个,应该是基本事情额,我 django3.0 没遇到这样的事情..楼主只能再仔细查一下了
    nonduality
        2
    nonduality  
       2020-09-21 21:19:26 +08:00
    这个是相对路径导入的问题,搜下 relative import
    callmebigfaceman
        3
    callmebigfaceman  
    OP
       2020-09-22 15:06:55 +08:00
    @blueaurora
    @nonduality
    谢谢大佬,我仔细查了,还是不知道问题在哪里。。
    nonduality
        4
    nonduality  
       2020-09-22 17:37:05 +08:00
    简单讲,你在 pycharm 里没设置好让 django 做相关的 setup,便会出 ModuleNotFoundError 。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2831 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:49 · PVG 22:49 · LAX 07:49 · JFK 10:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.