Issue
New to cloud hosting in Azure, recently created a flask webapp that will open, if not generate a txt file(with root directory), but i dont think if there is any way to access that file? i have not created or subscribed to any storage services provided by azure yet. Will i be charged since the file is technically stored somewhere but i cant access it?
Solution
I have created a flask app which creates a text.txt
file and deployed it to web app in Azure using VS code.
you can get the created file inside the file output.tar.gz
.
app.py
:
from flask import Flask
app=Flask(__name__)
@app.route('/')
def Hello():
text ='hello, File created using flask app'
with open('text.txt', 'w') as file:
file.write(text)
return "this is a Flask app"
if __name__=="__main__":
app.run()
deployment
:
OUTPUT
:
- Open kudu for linux app using this url
https://yourwebappname.scm.azurewebsites.net/newui
. - Go to
File Manager
, go to directorysite/wwwroot
and download theoutput.tar.gz
file. text.txt
file will be available inside the file. as shown below.
Answered By - Vivek Vaibhav Shandilya
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.