3

I have this in my main execution file:

databaseUrl = appPath + '/db/timey.db' 

which is pointing to my SQLite DB.

I have done some encapsulation for accessing my model (Data/DB). So until databaseURL finally gets used I would need to pass it from main -> view.py -> model.py -> db.py. This would be stupid because e.g. my view class doesn't need to know about my database or its path. So what would be a proper approach to actually make this path "globally" accessable without passing it around all the time?

I tried to make databaseUrl global, but I don't like the idea and haven't really gotten it to work like that anyway.

Storing the information in an external file would be an overkill, as it is the only (constant!) global used variable anyway.

Thank you!

4

1 に答える 1