[Answered ]-Relative path in Django settings

2👍

You can use os.path.abspath, os.path.dirname, os.path.join __file__ attribute of the module.

For example, the following code will return absolute path of the db file which exists at the same directory that containing settings.py:

os.path.join(os.path.dirname(os.path.abspath(__file__)), 'dbfile.sqlite3')

Leave a comment