यह कोड b.py:
path = os.path.join(os.path.dirname(__file__), os.path में Templates/blog1/page.html प्राप्त करता है। .join("templates", "blog1/page.html"))
लेकिन मैं पैरेंट डीआईआर लोकेशन प्राप्त करना चाहता हूं:
aParent |- -ए | |---b.py | |---टेम्पलेट्स | |----------ब्लॉग1 | |------- page.html |--templates |----------blog1 |-------page.html
और कैसे करें अभिभावक स्थान प्राप्त करें
धन्यवाद
अपडेट किया गया:
यह सही है:
dirname =os.path.dirname पथ = os.path.join(dirname(dirname(__file__)), os.path.join("templates", "blog1/page.html"))
या
path = os.path.abspath(os.path.join(os.path.dirname(__file__),".."))