Django - How to deal with the paths in settings.py on collaborative projects

后端 未结 5 1296
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-01 08:17

I have just started a feasibility study on Django for my company and I have noticed the need for absolute paths on settings.py:

TEMPLATE_DIRS = (
   # Put string         


        
5条回答
  •  逝去的感伤
    2021-02-01 09:09

    Do this:

    import os
    ROOT_PATH = os.path.dirname(__file__)
    .
    .
    .
    TEMPLATE_DIRS = (
        os.path.join(ROOT_PATH, 'templates'),
    )
    

    This will set the paths according to the directory of settings.py file

提交回复
热议问题