火冰狐 发表于 2018-8-11 07:56:23

Python import-felixcode

  python 的import是需要将项目目录加到python的环境变量里面
  这样才能用项目的相对路径来导入文件
  要运行文件加入
import os  
import sys
  
BASEDIR = os.path.dirname(os.path.abspath(__file__))
  
sys.path.append(BASEDIR)
  其它模块就是
from model.basemodel import Basemodel  项目结构
页: [1]
查看完整版本: Python import-felixcode