Django中将所有应用放在apps文件中时,需要配置

import os
import sys
import datetime

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, BASE_DIR)
sys.path.insert(0, os.path.join(BASE_DIR, "apps"))
sys.path.insert(0, os.path.join(BASE_DIR, "extra_apps"))

之外,还需要将其设置为source root

apps设置

相关文章:

  • 2021-04-28
  • 2021-12-25
  • 2021-11-03
  • 2021-10-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-24
  • 2021-09-15
  • 2021-08-16
  • 2021-12-24
相关资源
相似解决方案