import os
import sys
BASE_DIR = os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) )
sys.path.append(BASE_DIR)
from conf import settings
from core import main
main.login()
加到
sys.path里面,就可以引用调用了
解析:
os.path.abspath(__file__)
结果:atm.py
os.path.dirname( os.path.abspath(__file__) )
结果:
C:\Users\Administrator\PycharmProjects\demo\day4\Atm\bin
os.path.dirname( os.path.dirname( os.path.abspath(__file__) ) )
结果:
C:\Users\Administrator\PycharmProjects\demo\day4\Atm