Using Python's os.path, how do I go up one directory?

前端 未结 14 1734
陌清茗
陌清茗 2020-12-07 07:47

I recently upgrade Django from v1.3.1 to v1.4.

In my old settings.py I have

TEMPLATE_DIRS = (
    os.path.join(os.path.dirname( __file_         


        
相关标签:
14条回答
  • 2020-12-07 08:35

    You want exactly this:

    BASE_DIR = os.path.join( os.path.dirname( __file__ ), '..' )
    
    0 讨论(0)
  • 2020-12-07 08:35

    From the current file path you could use:

    os.path.join(os.path.dirname(__file__),'..','img','banner.png')
    
    0 讨论(0)
提交回复
热议问题