Questions tagged [flask]
The flask tag has no usage guidance.
147
questions
7
votes
2
answers
2k
views
Apache 2.4 authenticate anonymous users but allow others by IP
I am trying to configure Apache to allow users from a selection of IPs access to a Flask application without authentication, but to challenge any other users for credentials.
As things stand I have ...
7
votes
3
answers
12k
views
Nginx cannot see unix socket
UPDATE: I saw questions related to the /tmp directory, and a comment mentioned moving the socket out of /home as well. It didn't fix the problem.
(Additional updates at bottom of post)
I have a ...
6
votes
1
answer
11k
views
In airflow's configuration file `airflow.cfg` what is the `secret_key`, and do I have to set it?
As a comment above the value, it says # Secret key used to run your flask app, but that doesn't tell me much. Currently it is set to secret_key = temporary_key, but that seems unsafe. We have set up ...
5
votes
1
answer
13k
views
nginx + uwsgi - what is serving static files?
I am using nginx as a proxy to a couple of flask apps, with uwsgi as the middleware. Here's my nginx config for a test app.
server {
listen 80;
server_name test.myapp.com www.test.myapp....
3
votes
1
answer
1k
views
Docker, docker-compose application settings
I'm starting to migrate my Application to Docker containers:
I use Ngnix, supervisord, gunicorn, python flask, celery, flower, lighttpd, RabbitMQ and Postgresql.
In my original virtual machine, I keep ...
3
votes
1
answer
37k
views
failed (111: Connection refused) while connecting to upstream python [duplicate]
I am experiencing 502 Bad Gateway errors after deploying a python flask application using dokku on digital ocean. I followed this tutorial to deploy my app on digital ocean using dokku.
2018/10/23 07:...
3
votes
3
answers
2k
views
Nginx uWSGI responses truncated
I tried to write a web service as a joke today at http://dont-tread-on-memes.controversial.io. It's a flask app that serves fairly large images. The Flask app works well on its own, as does an ...
3
votes
1
answer
2k
views
Nginx change links to 127.0.0.1
I have a flask app running in a docker container, and I configured nginx to redirect all requests to this container. Here's my nginx config:
server {
listen 80;
location / {
proxy_pass http://...
3
votes
1
answer
2k
views
Python background task thread lock error with mod_wsgi
I have a small python web application built on the Flask framework and deployed with mod_wsgi to apache. The application is scheduling a background task with apscheduler that runs every couple of ...
2
votes
1
answer
3k
views
How to load static files in an Nginx + Flask setup if the app is mapped to a sub-directory
I have a basic html site running at a domain (say example.com) and I want to run a flask app in a sub-directory (eg:example.com/test)
flask app is running on port 5433 using the default flask ...
2
votes
1
answer
3k
views
Can not start a Docker container
I Built an image using flask, nginx and uwsgi.
FROM ubuntu:14.04
MAINTAINER Ali Mezgani <[email protected]>
RUN apt-get update && apt-get -y install python python-dev python-pip
RUN ...
2
votes
1
answer
762
views
source venv/bin/activate isn't returning anything on CentOS
I'm trying to deploy a Python Flask app (for API endpoint) on CentOS for work, but every online guide I've followed isn't working for me!
python3 -m venv APIenv
The env was created successfully, but ...
2
votes
2
answers
2k
views
Why is Apache2 not finding my WSGI app?
In my previous question, I asked how to make mod_wsgi use a specific Python version. Following the answer from that question, I created a Python 3.9 virtual environment and made WSGI use it. However, ...
2
votes
1
answer
3k
views
Flask to uwsgi threading get stuck
im Using Python 3.7.3, uwsgi 2.0.18, (docker container image python:3-stretch)
We have development environment where we are running our code on flask and we change it to uwsgi when we test it on ...
2
votes
1
answer
1k
views
Nginx + GUnicorn + Flask + www-data user - file lockdown
I have some pretty basic questions about I am deploying a Flask application in Gunicorn (19.0-1) on Ubuntu (14.10) in combination with Nginx.
Since this app sits along side to Web2Py, I followed a ...
2
votes
1
answer
1k
views
Why is Nginx truncating the JSON streaming response?
Our stack is Client(Browser) <-> Nginx Reverse Proxy <-> Webserver(Flask+Gunicorn) <-> Golang gRPC server
The problem is when the client makes a call to the /realtimedata endpoint, ...
2
votes
0
answers
2k
views
Nginx + uWSGI + Flask Connection Reset
Problem
I have a Flask app deployed using Elastic Beanstalk's "Single Container Docker" platform (latest revision 3.2.5 at the time of writing), with an "Application Load Balancer" ...
2
votes
0
answers
3k
views
Timeout when reading response headers from daemon process. Python, Flask, Apache
I have a problem with my mod_wsgi configuration. Sometimes, I think when there is a lot of traffic on my website, the page breaks and says "Resource temporarily unavailable..."
Apache logs:
...
2
votes
0
answers
4k
views
Cannot connect to Flask server via public IP, only private IP
I have a simple Flask server that echos requests it gets to the terminal. Requests I send it via the device's public IP address do not register.
The flask server is started correctly on all ...
2
votes
0
answers
4k
views
Systemd Unit file for uWSGI Failure
Using Flask, NGINX, and uWSGI I have setup successfully setup an app that I send and receive text messages through Twilio. Everything is working perfect, except that it is running under my personal ...
2
votes
0
answers
2k
views
uwsgi + nginx + flask: upstream prematurely closed after file is downloaded
I created an endpoint on my flask which generates a spreadsheet from a database query (remote db) and then sends it as a download in the browser. Flask doesn't throw any errors. Uwsgi doesn't complain....
1
vote
3
answers
4k
views
Uwsgi and flask with unix socket instead of URL
I was trying to find out the difference between a socket as a unix file and a socket that is a ip and port.
If I switch something like uwsgi to use a file instead of a port and ip, how do I then ...
1
vote
1
answer
11k
views
How to deploy a WSGI/Python app behind Nginx on Windows?
Coming from the Linux environment, I'll try to be as accurate as possible with Windows concepts I clearly don't master.
Here's my current situation:
I have a functional Windows (10 pro x64) Nginx ...
1
vote
1
answer
3k
views
Set up IIS to reverse proxy an internal server
I have a Linux server serving a Flask application with Gunicorn. I have a separate Windows server with IIS. Only the IIS server is accessible publicly. How can I set up IIS as a reverse proxy to my ...
1
vote
1
answer
4k
views
Proxying a Flask app with gunicorn and nginx
I have a Flask application that is currently being served on a machine (call it first_vm) using the following command in supervisord:
gunicorn run:app -b 0.0.0.0:8002 -k socketio.sgunicorn....
1
vote
1
answer
1k
views
How to protect against session hijacking in Flask [closed]
So, i'm developing a Flask web-app and i wanted to test its security since i've implemented the following:
SSL Cert with cookies being securely transmitted
CSRF token to avoid CSRF attacks
Cookie ...
1
vote
1
answer
3k
views
uwsgi with flask and python3 conda environment is loading python2 instead
I'm trying to run a python3 flask web application with uwsgi.
If I run /usr/bin/uwsgi --ini /var/www/QCQuan/uwsgi_config.ini --logto /tmp/log then uwsgi fails and the log file shows:
Python version: ...
1
vote
1
answer
5k
views
Nginx serve static files for flask app 404
I've tried numerous solutions of other posts, but nothing seems to work for me, I always get a 404 error, when trying to let nginx serve static files of my flask application. Somewhere in between all ...
1
vote
1
answer
4k
views
NGINX + uWSGI + Flask. Some requests very slow
We're running a fairly large Flask application and finding that at random times we'll end up with a very slow request (sometimes a minute or more)
I presume the issue is related to lazy-loading ...
1
vote
1
answer
854
views
Running multiple flask applications with different domain names using mod_wsgi
We are trying to run 2 different flask applications with different domain names from same server using mod_wsgi + Apache2.
This is the settings configured in httpd.conf
# For www.yyy.com
...
1
vote
1
answer
2k
views
Powershell: start and stop flask server
I wrote a powershell script to start my flask server, run my tests then stop my server. It starts the server and runs my tests. However, when it kills the $server process, it leaves the actual server ...
1
vote
1
answer
3k
views
flask, gunicorn (gevent), sqlalchemy (postgresql): too many connections
I created Flask WSGI-application which uses gunicorn as WSGI-server, for DB it uses PostgreSQL through Flask SQLAlchemy extension. That's all hosted on Heroku.
gunicorn configuration
number of ...
1
vote
1
answer
6k
views
Import Error on deploying a flask app on apache
I am trying to deploy a flask app on a VPS using WSGI. I am not using a virtualenv, and pandas is installed on the system:
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
...
1
vote
2
answers
2k
views
Docker compose and nginx load balancer
Currently I have 2 Docker containers:
Application (python flask)
Load Balancer (nginx)
I'm starting both containers separately with docker-composer up
Nginx is listening in port 8080 and should ...
1
vote
1
answer
1k
views
nginx - serve only with backend or 404, no static files in root
I am trying to serve all requests with the backend (uwsgi for flask in this case) and if the backend has no such path, nginx should return 404.
Somehow I only can get the backend to take over when I ...
1
vote
1
answer
1k
views
Supervisord, Flask, Tornado (exit status 1; not expected)
Having some issues getting supervisor to run my tornado apps.
I have a REST API built with Flask, using Tornado to try and serve it. Problem I am having is that when I try to run with supervisor it ...
1
vote
0
answers
159
views
nginx Failing to Serve Static Files to Flask
I've tried numerous solutions of other posts, but nothing seems to work for me, I always get a 404 error, when trying to let nginx serve static files of my flask application. On my local host server, ...
1
vote
0
answers
531
views
how to fix apache server :(20014)Internal error : AH01102: error reading status line from remote server 127.0.0.1:5000
I use a flask server in apache.
run a script which prepare then download an xml file.
this is working fine is script
but if script lasts longer than 80 sec it's stopped and http error 502 is displayed ...
1
vote
0
answers
630
views
Python flask captive portal
Im making python tool for creating access point with hostapd, run http server on 10.0.0.1, and using dnsmasq redirect clients to the http server login page
Its working when i use localhost as hostname,...
1
vote
0
answers
8k
views
How to show python console output to website using flask
This is the flask file
from flask import Flask, redirect, render_template, request
from subprocess import call
app = Flask(__name__)
@app.route('/')
def mai():
return render_template('homepage....
1
vote
1
answer
478
views
Unable to deploy simple flask app on ubuntu vps
I am trying to deploy a simple flask app on an VPS running Ubuntu 20 and LAMP
The app runs fine when I execute it with flask run from inside the app folder
However the server log has errors:
[Sun Oct ...
1
vote
2
answers
3k
views
Gunicorn/Flask reject identical SSL certificate that works fine with Apache
What would cause a Gunicorn server running a Flask app to report a "sslv3 alert certificate unknown" error in the browser, when an Apache server running a WSGI app, using the exact same ...
1
vote
0
answers
100
views
Unsuccessful flask app deployment on Amazon EC2 instance
I am trying to deploy a flask app on an Amazon EC2 instance. I have configured everything just fine but the website does not load. It remains stuck on the loading icon as follows:
Website not loading
...
1
vote
0
answers
2k
views
CORS error despite CORS being enabled in app server and Nginx
I have a web application and server which is fully functional in a debugging environment, however when it's hosted for production, I get the following error in the browser console:
Cross-Origin ...
1
vote
1
answer
1k
views
Cannot `pip install flask` in Python3.6 virtual environment
I'm trying to follow a MS DevOps tutorial here: https://microsoft.github.io/PartsUnlimitedMRP/pandp/200.1x-PandP-LocustTest.html
I've tried Ubuntu and CentOS, both produce the exact same failure:
(...
1
vote
0
answers
707
views
Subdomain setup for Flask + apache
I have installed and deployed Flask on a CentOS server but the subdomain for some reason, is not working properly. I really need some help on this one. I am actually a newbie in this field so please ...
1
vote
0
answers
668
views
Should I avoid CORS when building an SPA with backend API hosted on the same server?
I've stumbled upon this question and had the thought that my application should not require CORS, since it is hosted on the same server (a raspberry pi).
However, since CORS is a security "feature" I'...
1
vote
0
answers
374
views
Flask app to upload an image file via Apache 2 not working
Running Apache/2.4.41 on Fedora 30 and python3-mod_wsgi-4.6.4-3.fc30.x86_64. And doing a test with: mod_wsgi-express start-server /var/www/flask/upload_pictures.wsgi --user myuser works mostly fine ...
1
vote
0
answers
31
views
mail form api security
I am working on a static site generated with hugo and want to embed an email form without using external (commercial or possibly untrustworthy) services like formspree.io (too much of a headache in ...
1
vote
0
answers
419
views
Getting Mod_WSGI Error: Deploying Flask Application to ElasticBeanstlk
I am current trying to deploy a Flask Application (an API Application) onto Elastic Beanstalk. But I am getting mod_wsgi error.
Here is the error message:
[Fri Jun 01 06:10:49.314023 2018] [:...