python - Flask-ImportError: ModuleNotFoundError: No module named 'mycode'
问题描述
ImportError while loading conftest '/home/rohit/flask/src/tests/conftest.py'.
conftest.py:6: in <module>
from mycode import create_app
E ModuleNotFoundError: No module named 'mycode'
当从 mycode 文件夹上方的 src 文件夹运行 pytest 时,它会给出 ModuleNotFoundError
目录结构如下
├── mycode
│ ├── auth
│ ├── auth.py
│ ├── db_insert.py
│ ├── db.py
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── auth.cpython-37.pyc
│ │ ├── db.cpython-37.pyc
│ │ ├── db_insert.cpython-37.pyc
│ │ └── __init__.cpython-37.pyc
│ ├── README.md
│ ├── schema.sql
│ └── templates
│ ├── auth
│ │ ├── login.html
│ │ └── register.html
│ └── base.html
└── tests
├── conftest.py
├── data.sql
├── __pycache__
│ └── conftest.cpython-37-pytest-5.4.1.pyc
└── test_factory.py
解决方案
推荐阅读
- python - 获取主键组合对应的最大值
- javascript - XPATH 做一个没有双胞胎的元素列表
- android - Android中的OkHttp Mutual SSL
- mysql - Docker Compose mysql 环境变量与 Application .env 数据库变量。很困惑
- ti-basic - TI-82 字符串变量?
- python - Pandas:使用列在两个 DF 上左合并,但只取另一列的最后一个(或平均值)
- audio - 如何找到在一定时间内使用的静默字节数?
- python - 如何计算每个元素在数组中出现的次数?
- d3.js - 如何更改 d3 observable notebook embed 的高度
- python - 如何将 <"Return"> 键和按钮小部件绑定到 Tkinter 上的相同功能?