Questions tagged [flask]
Flask is a lightweight framework for developing web applications using Python.
flask
21,621
questions with no upvoted or accepted answers
20
votes
2
answers
3k
views
FastCGI, Lighttpd, and Flask
I'm setting up a simple web server on my Raspberry Pi and I can't seem to set up lighttpd, fastcgi, and flask correctly.
By now, I've gone through a few iterations of /etc/lighttpd/lighttpd.conf, the ...
17
votes
1
answer
14k
views
Place to initialize DB in Flask
I'm developing app in Flask and it requires DB, so what I have is I do:
app = Flask(__name__)
@app.before_request
def init_db_connection:
# here I connect to my DB
@app.teardown_request
def ...
15
votes
1
answer
1k
views
Flask SERVER_NAME setting best pratices
Since my app has background tasks, I use the Flask context. For the context to work, the Flask setting SERVER_NAME should be set.
When the SERVER_NAME is set the incoming requests are checked to match ...
14
votes
2
answers
3k
views
gunicorn occasionally freezes until worker timeout in trivial docker web app with flask
I built a trivial docker web app with flask and gunicorn. Everything works, but occasionally when making a request, the response hangs. I see nothing in logging until the worker times out. So it seems ...
14
votes
1
answer
431
views
Openface Flask Wrapper: Flask seems to be blocking a thread
I am trying to write a small flask REST API wrapper around the openface api so that I can POST image URLs to my flask server and have it run a comparison of the image against a classifier model
app = ...
14
votes
1
answer
3k
views
uwsgi segmentation fault when using flask and python requests
I'm running a dev uwsgi server using flask and a call to requests.get is triggering a segmentation fault in the uWSGI process.
Segmentation Fault:
!!! uWSGI process 70490 got Segmentation Fault !!!
*...
14
votes
1
answer
749
views
Flask: How to detect disconnection in infinite response generator?
In flask I have a page that is used with EventSource to receive updates/events.
It's implemented in fairly trivial manner:
@route('/updates')
def updates():
def gen():
while True:
...
12
votes
1
answer
4k
views
Unrecoverable error: ResponseError('UNBLOCKED force unblock from blocking operation, instance state changed (master -> replica?)
I'm using a redis docker container to be used as a message/ broker queue for celery and flaskk-socketio in my python app and lately my redis instance is crashing pretty often, and it doesn't come back....
12
votes
1
answer
3k
views
How to map LDAP AD Groups to User roles in python flask AppBuilder
I'm currently trying to map automatically user groups in LDAP to user roles in a flask AppBuilder framework based application but can't come up with a solution. I have read through the entire flask ...
12
votes
1
answer
3k
views
LocalProxy objects in Flask-SQLAlchemy
I'm using a lot of werkzeug.local.LocalProxy objects in my Flask app. They are supposed to be perfect stand-ins for objects, but they aren't really, since they don't respond to type() or instanceof() ...
11
votes
1
answer
2k
views
Can't pickle <class 'MemoryError'>: it's not the same object as builtins.MemoryError
I am using multiproccessing pool map in Python 3.7 and I am getting error like below with Docker container.
multiprocessing.pool.MaybeEncoding Error: Error sending result: '<multiprocessing.pool....
11
votes
0
answers
10k
views
Flask-Login - Remember Me working automatically
I am writing a simple login page using flask-login and trying to implement Remember Me functionality.
To my surprise Remember Me is working automatically without setting the remember=True in the ...
11
votes
0
answers
3k
views
Python, Flask, Elasticbeanstalk Logging
I am trying to use Elasticbeanstalk to deploy a Flask REST API. Logging and the application works with no issues on my test system. However, I am not getting the logs from the ebs instance using the ...
10
votes
1
answer
2k
views
gunicorn Flask application hangs in Docker
I have a Flask application that I run through gunicorn (on a Dell latitude 5410 laptop with Ubuntu 20.04) and I configured the Docker to run it as suggested in this wonderful guide.
Here is my boot.sh:...
10
votes
1
answer
786
views
How to check which the fields of a form has been modified in Flask?
I am trying to figure out a way to check if there is any built-in Form method that would return true if the form has been modified in Flask/WTForms
I know that in Django Forms, we have that ...