trying to dockerize this flask app… running the following docker build –tag flask-website . works, output successfully built, successfully tagged. edit: the next command works ok, so then I run curl localhost:5000 which gives this error ok straight forward enough, so then I try this docker-compose up and this results however trying to navigate to localhost:5000 I get directory structure
Tag: flask
Flask: unable to serve rendered pages from specific directory
I have a bunch of files in a directory that I wish to render and serve to the user, but have been unable to. Going to the path always returns just the ‘page_template.htm’ and not the rendered file. Here’s my code: What I wish to do is to grab raw text files from the ‘Special_Data’ directory and to render them
Flask flash message on all endpoints
In my Flask app I have user management done via flask.session. So all info about logged in user is stored in session. When some new user registers, in database I create new row with one attribute being verified set to false and the same information is stored in session[‘user’][‘verified’]. When user browses the website, no matter which endpoint, I want
Flask – how to call python function with parameters in button?
I am working on a notification system on my website. I decided to make a model in the database for them. I also made a function in views.py that takes an argument of a user that is receiving a notification and the type of notification. Here is the code: Now I want to be able to send the user a
botocore.exceptions.ConnectTimeoutError: Connect timeout on endpoint URL
I am using boto3 to read many text files in S3 through a Lambda Python function. My codes for the connection to S3 below About 30 text files are successfully ok. But after, it gets below error message Any way I can resolve this? Answer Lambda in a VPC does not have public IP and therefor can’t access internet from
sqlite database didn’t update table in my flask webhook python code
I try to update my sqlite database using flask webhook. It seems commands line work fine if I type manually in the python console but my flask webhook didn’t update my SQLite database. It seems the apps fail at the “cursor.execute()” line. here is my webhook code: Can you please tell me what’s wrong with my code ? if it’s
curl getting redirect instead of response
I’ve tested my REST API via Postman and tests and got a response, but when I use curl I’m getting screen from postman enter image description here the code: app.py route.py controller.py Answer By default curl doesn’t follow redirection, you have to use -L argument. In curl’s tradition of only doing the basics unless you tell it differently, it does
Flask App Deployment: Internal Server Error
I recently tried to deploy a flask app using Heroku. However, I encountered an internal server error. My code can be found here: https://github.com/chaneth8/Task_List. This is the message that appeared on my log in Heroku – what could the error be? Thanks in advance. Answer I studied your code and hosted the same on https://ethan-flask.herokuapp.com/ The blunders you did: from
Flask CLI shows “TypeError: exceptions must derive from BaseException”
When I run Flask from the terminal with flask run, if my code has an error I see “TypeError: exceptions must derive from BaseException” instead of the actual error. To debug it I need to open the browser and inspect the exc_info variable in the Werkzeug debugger, which is not convenient. Why is Flask doing this? How can I see
Flask – How to get the file extenstion, without using file.content_type
I have this code: And what I would like to do is get the file extenstion, like .md, .txt and automatically add it to the list of allowed content types. I have looked at the docs but can’t find what I’m looking for. Heres the content type list: Thanks in advance! Answer Looking at the comments, it seems your answer