For example, when using django I can get my settings from anywhere within the project using from djanog.conf import settings
. I don't have to specify where django.conf
is, it just knows. How does it know?
I ask because I'm building a project where I need to be able to import a conf
file without knowing the relative path. Right now I have to figure out the relative path to the conf
file each time I use it. I would prefer to just do something like from config import settings
. I figure I need to add my conf
file to sys.path
but I'm not sure where to do this. Is there a standard way for handling this type of problem in python?
I'm sure some variation of this question has been asked hundreds of times before but I can't seem to find the answer. If you know of a good answer that already exists please let me knows. Thanks.