Getting Django SQLite file out of Web App

Matthew Kestenbaum 20 Reputation points
2023-08-24T23:14:30.0766667+00:00

I released my website a couple weeks ago, and having no experience with deployment before, I uploaded my Django files - including SQLite - to Github and used Github CI to deploy my Web App. This was never supposed to be a permanent solution, just something to get my site up and running. However, if I make any changes now to my local repository and commit them, it will undo all of the website database changes.

Luckily my website is just starting, and there is not that much new data in the SQLite database. However, there are 10s of users with data, and I don't want to get rid of it. I of course want to switch to a better and more robust database system. However, before I do this I need to retrieve the data from my SQLite database, that is within Azure (not my local one).

How can I extract my SQLite database from my Azure Web App? With FTP or Kurus, I am able to download a .tar.gz that has my sqlite file in it. However, this file is not updated with the server versions of the database. They only have the same one that is on Github. I know there are Django scripts that can extract from the database, and am thinking about that. But, in order to do this, I need to be able to upload this Django script to the Web App - which if done through Github CI, will revert my database.

I know my own ignorance got me into this issue, but is there any way out without getting rid of all my user data that isn't local ? Really appreciate any thoughts / help on this one.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,933 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Matthew Kestenbaum 20 Reputation points
    2023-08-28T04:24:53.69+00:00

    @Bharathi G, Rajkumar I can't access the filesystem through 'Kudu -> Debug Console' because I'm running a Web App on Linux. When I try to access the file system through the "Browse Directory -> wwwroot" it shows the same files as when I FTP in, which "output.tar.gz", "oryx-manifest.toml", "hostingstart.html" and ".ostype". When I download and extract 'output.tar.gz' it gives me the SQLite file from my Github repo, not updated with the current server database.

    When I use SSH in Kudu, and I type 'ls', it outputs me my Django file system including the SQLite file. However, I'm unsure how to download the file from SSH? It is just a console and does not have any Kudu file management system in it. Also, I'm not sure if this is the updated SQLite file or if it is the same one as from FTP.

    0 comments No comments

  2. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-08-29T20:35:27.5666667+00:00

    Apologies for the delayed response from over the weekend. Thanks for the follow-up and additional info.

    Kindly follow the similar approach outlined in this GitHub discussion thread - The context for the discussion was when the database is in a VNET, but the approaches to extract data should help your situation as well. Essentially it boils down to using ssh and scp: [Featurerequest] Add section on how to connect to and query the database once deployedto Azure · Issue #34 · Azure-Samples/msdocs-flask-postgresql-sample-app(github.com).
    As you mentioned above (/discussed), for production purposes kindly leverage hosted database (PostgreSQL, MySQL).

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.