Disclaimer: I am a beginner, just a highschool kid who loves to code.
I have nice blog site made with Flask and I have taken a little bit of an unusual approach. Instead of typing the contents of each blog, I create an HTML file for each. It just felt like it gives more flexibility. During upload, the app takes the following:
- Category (Article/ Project/ Blog) [unrelated]
- HTML file of the post
- URL for the post (unique /web_post/ for each post) [unrelated]
- Images in the post, these images are accessed from within the HTML file
- Audio version, also accessed from HTML file
Now, the HTML file is uploaded into /website/posts/ (/ is where my app.py that runs the app is) and the images and audio are uploaded into /website/post_media
Everything works perfectly.
Since I am deploying from git, I need the empty directories “posts” and “post_media” to able to add it to the repo and the deployment. So, I have empty .gitkeep files in each.
What I am assuming is, everytime I push a commit to the repo, koyeb redeploys THE WHOLE THING, as it is in the repo and doesn’t merge with the previous deployment.
You might see where my issue lies. When I commit anything, the uploaded files in the local directories are gone and voila NO POST! It still exists in the PostgreSQL Database, but it can’t load the page, because there is no page to load from. So please help me out here…
Is there a way to keep the old files after redeployment? [maybe adding the directories to .gitignore? But as I said, I think Koyeb build the repo from scratch so this would make it worse]
OR
Do I have to do it the very manual and very inefficient way (it also feels illegal) of also putting the files in the local directory (on my PC) and then commit and push to git along with those files?
Thank you in advance