Skip to content Skip to sidebar Skip to footer

Flask App Runs Smoothly Locally But Getting Error When Deployed On Heroku

I have Flask app and within the app, I have a view where I am using xlsxwriter to write and save Excel file. When I run the app locally it works perfectly. When I deploy it all the

Solution 1:

First

You're starting your app on heroku but using hardcoded pathes in your code os.startfile("C:\\Users\\Nenad\\Desktop\\magacin vs\\ISPRATNICI\\{}, {}.xlsx".format(s.id, s.ime))

Second

You're using os.startfile which is only available on windows, heroku doesn't run windows.

Third

You can't access file system on heroku anyway. Only during the deployment and even that is not enough, as everything not related to deployment will be removed at midnight.


If you really want to save xls on heroku - you'll have to rewrite your application to be "linux compatible" and consider saving your file in database.

Post a Comment for "Flask App Runs Smoothly Locally But Getting Error When Deployed On Heroku"