Questions tagged [flask]

Flask is a lightweight framework for developing web applications using Python.

Flask is a web application framework for . It has exceptional documentation, a large number of extensions and a friendly community on Discord. It is open source and BSD-3-Clause licensed.

Resources

Related Tags

54068 questions
13
votes
3 answers

How to have an alias of URL on Python Flask?

I'm using Flask 0.8. How to have an alias of a URL like this: @app.route('/') def index(): # I want to display as http://localhost/index, BUT, I DON'T WANT TO REDIRECT. # KEEP URL with only '/' @app.route('/index') def index(): # Real…
hof0w
  • 205
  • 1
  • 3
  • 5
13
votes
2 answers

Activating the Flask debugger when running under mod_wsgi

How can I activate the Flask debugger when running under mod_wsgi? I have DEBUG, PROPAGATE_EXCEPTION and PRESERVE_CONTEXT_ON_EXCEPTION set to True, but still the debugger doesn't appear on exceptions.
jd.
  • 10,678
  • 3
  • 46
  • 55
13
votes
1 answer

Can't get Flask running using Passenger WSGI on Dreamhost shared hosting

I'm trying to get a Flask "hello world" application working on a Dreamhost shared server, following the instructions on their wiki, but I'm not having any luck. My Flask application is the "hello world" one from the Flask quickstart guide: from…
Dave Hollingworth
  • 3,670
  • 6
  • 29
  • 43
12
votes
5 answers

How do I redirect to the www. version of my Flask site on Heroku?

I've got a Python Flask app running on Heroku (Cedar stack) with two custom domains (one with and one without the www subdomain). I'd like to redirect all incoming requests to the www. version of the resource requested (the inverse of this…
John Sheehan
  • 77,456
  • 30
  • 160
  • 194
12
votes
3 answers

Issue a POST request with url_for in Flask

I'm trying to issue a POST request within a Jinja template in Flask. However, parameters are passed in via GET by default, and this particular method only accepts POST requests. I tried specifying _method, as below, but it still passes the parameter…
chimeracoder
  • 20,648
  • 21
  • 60
  • 60
12
votes
1 answer

Adding REST behavior to a class with flask, case for blueprints?

I am dealing with a python application that consists of multiple distributed lightweight components that communicate using RabbitMQ & Kombu. A component listens on two queues and can receive multiple message types on each queue. Subclasses can…
dgorissen
  • 6,207
  • 3
  • 43
  • 52
12
votes
2 answers

Get variables from a settings.py file in a Jinja template with Flask

Say I have settings.py file with a bunch of constants (maybe more, in the future). How do I access those variables in a Jinja template?
john2x
  • 22,546
  • 16
  • 57
  • 95
12
votes
4 answers

No module named 'application' Error while deploying simple web app to Elastic Beanstalk

I am deploying a web app to elastic beanstalk using this tutorial and the same 'application.py' file they have: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-flask.html#python-flask-setup-venv I get a 502 error when…
12
votes
2 answers

Flask: how to register a wrapper to all methods

I've been moving from bottle to flask. I'm the type of person that prefers writing my own code instead of downloading packages from the internet if I the code needed is 20 lines or less. Take for example support for Basic authentication protocol. In…
nachonachoman
  • 802
  • 1
  • 13
  • 29
12
votes
3 answers

AttributeError: 'Request' object has no attribute 'is_xhr'

I am trying to run cuckoo api. Cuckoo web is working fine on my system. But when I tried cuckoo api, I got the following error: File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app response =…
Meena Bharti
  • 161
  • 1
  • 2
  • 6
12
votes
2 answers

Working with WTForms FieldList

I use WTForms with Flask via the Flask.WTF extension. This question isn't Flask-specific, though. WTForms includes a FieldList field for lists of fields. I'd like to use this to make a form where users can add or remove items. This will require some…
Kiran Jonnalagadda
  • 2,606
  • 1
  • 30
  • 29
12
votes
1 answer

Celery + SQS is receiving same task twice, with same task id at same time

using celery with SQS in flask app but celery is receiving same task twice with same task id at same time, running worker like this, celery worker -A app.jobs.run -l info --pidfile=/var/run/celery/celery.pid --logfile=/var/log/celery/celery.log…
ssnitish
  • 155
  • 9
12
votes
2 answers

How to stream live video frames from client to flask server and back to the client?

I am trying to build a client server architecture where I am capturing the live video from user's webcam using getUserMedia(). Now instead of showing video directly in
akan
  • 421
  • 1
  • 4
  • 13
12
votes
1 answer

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. I'm not a redis expert and I couldn't yet find…
magnoz
  • 1,939
  • 5
  • 22
  • 42
12
votes
1 answer

Flask reloader crashes with "no module named Scripts\flask" on Windows

When I run flask run on Windows, I get the following error C:\Python37\python.exe: No module named C:\Python37\Scripts\flask This was working previously, the issue started after I created a new env recently.
axmed
  • 129
  • 7