Reputation: 66
I am designing a small program to help me with the management of links for online classes.
It works in linux through the console, it is created as a python package, with setup.py to be able to install it by pip or pipx.
The data of classes, links, teachers, etc. is saved in a data.db file that works with sqlite3. I store it in the database folder, therefore the directory looks like this. workdir
db.py file finds database with these commands
dirname = os_path.dirname(__file__)
path = os_path.join(dirname, "database/")
When I install it with pip --editable it works but without it it doesn't work.
I understand why this happens and I think I could somehow force to include the database folder in site-packages / myproyect, but I think this solution is not professional at all and I don't like it.
So I come to you to ask for advice, where do I store the database? In which directory?, How do I do it in the most professional way?
P.S. it's my first project and I'd really appreciate your guiding me
project link: https://github.com/fraco-oxza/classgo
Upvotes: 2
Views: 1016
Reputation: 22452
My recommendation is to use something like platformdirs
, and store the database in "user data dir".
Upvotes: 1