0

I'm currently developing a web application using Flask, this app takes information from a SQL database to generate a .pdf that the final user can download from the browser.

My problem is that some hours after I deploy the app using Azure App Services, make some changes to the SQL database and generate some .pdf, the app automatically resets to its original state, therefore, I lose all the changes to the SQL database and generated documentation as it had some kind of ephemeral memory.

Is there any way in which I can store these files without losing them after a while?

In this case what Azure service/solution do you recommend me to use to store these files?

The data generated once the app is in use should be pretty little, the SQL will be updated once a month with a couple of .pdf generated.

Carlos S. C.
  • 101
  • 7
  • How/where are you running this database? Azure SQL database, which I assume is what you mean, doesn't do that. Are you working in a training or trial subscription? Unless there is something special about your situation you haven't mentioned it seems likely that you don't have the problem you think you have, because SQL databases don't just lose data. More information is needed. – Tom W Aug 21 '21 at 22:27
  • Hi Tom, thanks for the reply, I'm actually pretty new with web development, this is the first app I try to deploy with Azure. I created the sql database using sqlite and is at the moment in a .db in my /app directory, I can try looking some tutorials to create an Azure SQL Database and that could solve my problem. Now my other question, what can I do for my .pdf documents? I simply lose those files after a while. Do I need to create another database for that? I would really appreciate some general explanation because as I mentioned I'm pretty new with this. – Carlos S. C. Aug 21 '21 at 22:48
  • @TomW, by default, when redeploying it will remove all the olds files. depending on how you deploy your app you can set the option not to delete the files. i would also suggest you to store the file in sotrage account container where it can be persisted. – Thomas Aug 21 '21 at 22:50
  • @Thomas I don't think that's true. I had to go looking for [this setting](https://stackoverflow.com/a/46802531/313414) one time, and the default is disabled. – Tom W Aug 22 '21 at 07:35
  • @Carlos S. C. This makes more sense now, thanks. I expect your .db file is in one of [these locations](https://github.com/projectkudu/kudu/wiki/Understanding-the-Azure-App-Service-file-system#temporary-files) which as the documentation mentions, can't be trusted to remain. I agree with Thomas that a storage account is probably the way to go here. It can be configured as a [file share](https://learn.microsoft.com/en-us/azure/storage/files/storage-how-to-create-file-share) so your application code can access it as a normal network path. – Tom W Aug 22 '21 at 07:39

0 Answers0