Best Practices for Storing Application Data in Python

January 13, 2026 4 answers
Asked by !tighten the knot
I'm developing a larger application using Python on MacOS, with plans to deploy it on a Linux system later. Currently, I've created a folder in my project directory for logs and other files, but after compiling the application, I noticed I no longer have that project folder. I'm curious about the standard practices for storing project files and whether I should use a library or just write a simple script to define the paths and create them if they don't exist.

Answers

pwm.11pct
For project code, pushing it to a remote Git repository like GitHub or GitLab is the way to go. As for application data, using a database like PostgreSQL or SQLite is advisable. PostgreSQL works well for cloud applications, while SQLite is great for local setups. Both options come with Python libraries for easy integration.
Reply to this answer
n2_logscale
You don't necessarily need to save logs inside your project directory; you can choose any location, even a root folder. Generally, for deployable applications, it's common to avoid writing files directly. Instead, many apps log data to databases or expose it through API endpoints.
Reply to this answer
double-sided
Since you plan to deploy on Linux, consider writing logs to standard output. If you set your application up as a systemd service, its output will be captured in the system logs, which you can access using `journalctl`.
Reply to this answer
_draft_revision_
It's much better to use a library for this kind of thing. It handles many tricky aspects that you'd otherwise have to manage manually.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions