开发环境的注意

来源:互联网 发布:开淘宝网店要多钱 编辑:程序博客网 时间:2024/05/22 16:39

不同的开发环境目录结构不一样,不同的系统不同的定义。

import osimport sysimport platformif platform.system() == "Windows":    BASE_DIR = "\\".join(os.path.abspath(os.path.dirname(__file__)).split("\\")[:-1])else:    BASE_DIR = "/".join(os.path.abspath(os.path.dirname(__file__)).split("/")[:-1])sys.path.insert(0,BASE_DIR)print(sys.path)
原创粉丝点击