Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Python [Flask] How to programmatically terminate a Flask app ?

guys

New Coder
Hello

I have a flask app that should run once and then be destroyed. It should be deployed, show the user a parameters form, accept the parameters, do some calculations and then return a PDF report and exit. If the user wants another report they will deploy the app again.

So basically I need a route that will run some functions, return the PDF file and exit the whole app.
Creating and returning the report works just fine but is there a way to kill the server internally ? Something like "exit(0)" ? And if yes then where in the code shoulr I put it ?

Thank you

Guy
 
I don't think you understand how flask works. Flask runs on a web server such as apache or nginx. You should do a little reseach.
If all you want is to create a pdf and returning/save it, you should look at gui's such as tkinter, pyside, wxpython or one of the others.
 

New Threads

Buy us a coffee!

Back
Top Bottom