johnlins
HOBBYOP
2 years ago
I have a python project being hosted on railway, I would love to be able to, from python, write to the jsonl file from python and for that file to persist accross builds.
Is that possible or do I need to spin up a whole MongoDB server just for 1 files?
12 Replies
2 years ago
you would want to store that file in a volume
2 years ago
@Brody
Thanks, I just set one up!
Is this the intended use, because this and similar variations didn't seem to work:
data_folder = os.path.join(mount_path, "data")
os.makedirs(data_folder, exist_ok=True)
file_path = os.path.join(data_folder, "data_signedin.jsonl")
new_data = {
#...data...
}
print(new_data)
with open(file_path, "a") as file:
file.write(json.dumps(new_data) + "\n")```
2 years ago
what's your mount path?
2 years ago
so from your code it looks like you'll be storing data in /app/data/data
strange path, but it seems fine logically, what is the actual issue?
2 years ago
can you try to implement proper error handling

