a year 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
a year ago
you would want to store that file in a volume
a year ago
@Brody
Thanks, I just set one up!
Is this the intended use, because this and similar variations didn't seem to work:
``` mountpath = os.getenv("RAILWAYVOLUMEMOUNTPATH")
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")```a year ago
what's your mount path?
Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/f8243c2e-e45c-471d-8d65-718db8175ddb/vol_uejr9ska7cudz3d4 Starting Container
a year 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?
a year ago
can you try to implement proper error handling

