Skip to content

Tag: flask

How can I change the host and port that the flask command uses?

I want to change the host and port that my app runs on. I set host and port in app.run, but the flask run command still runs on the default 127.0.0.1:8000. How can I change the host and port that the flask command uses? Answer The flask command is separate from the flask.run method. It doesn’t see the a…

NameError: name ‘request’ is not defined

I got this Python Code, and somehow I get the Error Message: But I really can’t find my mistake. Can someone please help me with that? Answer You appear to have forgotten to import the flask.request request context object:

Displaying a .txt file in my html using Python Flask

I want to display my log.txt in my log.html. For some reason my page is completely blank. And I dont get to see anything from my file. Code: HTML LOG TEMPLATE: Added my HTML Template now. Answer but really you probably want to use something like logstash…

Return Excel file in Flask app

I am creating a Flask application that prompts the user for an Excel file, does some work with it, then returns the file back to the user so that they can download it. (Please ignore any unused imports. I plan on using them later on.) I have my functionality down, i’m just not sure how to send the file …