55,175 questions
Advice
0
votes
1
replies
37
views
Using flask_moment to display a date in the web user's local format
I am learning from Miguel Grinberg's excellent Flask Mega-Tutorial and writing an app which tracks the items in two freezers. Dates are saved in UTC in the database but I want to display them in the ...
3
votes
1
answer
65
views
How to pass variables to a template HTML with Flask
i'm currently learning Flask templates, but i can't undestand how to pass a variable to it. Example of my Python code:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def home():
...
0
votes
1
answer
58
views
Appropriate method to pass arguments in Flask without using the url
I am using flask and a deep learning model in tensorflow to display some annotated video. The module works fine but the loading of the model is lazy due to the nature of the generator. Only after I ...
0
votes
0
answers
52
views
Is there any way to fix type errors when overriding make_response?
I don't want to inherit from Response I want to use a pydantic model. I am doing this:
class AppResponse(BaseModel):
somefield: str
otherfield: int
class FlaskApp(Flask):
# Tried doing ...
0
votes
1
answer
28
views
Quart (Flask) file uploaded removed right after request completed
I'm using Quart (Flask fork) and I have a view which handles ".bin" file upload (100MB).
But on file.save(path) call I can see the file appears in destination folder for moment and ...
Best practices
0
votes
4
replies
83
views
Python: two Flask projects under the same HTTP Port
I have 2 separate projects running on the same Linux server. Both projects based on Flask. Due to infrastructure restrictions I'm able to use only one HTTP Port on the server.
I would like to route ...
0
votes
0
answers
60
views
send bulk mail in flask through 4 deferent deferent mails domain server
import os
import re
import time
from datetime import datetime
from smtplib import SMTPRecipientsRefused
import pandas as pd
from celery import Celery
from celery.schedules import crontab
from flask ...
1
vote
0
answers
39
views
Locust POST Request with .xlsx File to Flask Endpoint Returns a 503 Error
I am testing my Python Flask app using Locust to load-test a POST request with an .xlsx file attachment. However, I consistently encounter a 503 Service Unavailable error.
This issue ONLY occurs when ...
1
vote
0
answers
91
views
How can I use a return value in a flask endpoint from another flask endpoint?
I am currently working with flask endpoints that are connected to my react frontend. My return value for val is "null". Return data is 100% correct as it appears in my server log.
How can I ...
0
votes
0
answers
36
views
Nginx cutting off Flask streaming responses (with Docker) even with buffering disabled
I have a Flask backend running inside Docker, and it streams AI responses using a generator.
Locally it works perfectly, but after deploying with Nginx + Docker Compose, the streamed response gets cut ...
0
votes
0
answers
63
views
WebClient sending an empty multipart request to Flask service
I have a problem with sending multipart/form-data requests from my Java service (using WebClient but same history with RestTemplate) to Flask service. It seems like a sent body is just empty as I get ...
1
vote
0
answers
57
views
React/Axios file upload to Flask-RESTful gives 422 Unprocessable Entity
I'm trying to upload a file from my React frontend to a Flask-RESTful backend and I'm stuck on a 422 (UNPROCESSABLE ENTITY) error.
My backend logs show the POST request hits the right endpoint, but my ...
0
votes
0
answers
57
views
MongoDB Atlas Timeout After Deployment Update — "ReplicaSetNoPrimary"
I updated my backend deployment (Flask app) with a new feature not related to database logic, and suddenly MongoDB Atlas connections no longer work. Before the update, everything was fine.
Local ...
1
vote
1
answer
62
views
Serving js files from static folder in flask app with nginx and Docker
I have a strange issue with js files that cannot be found in a flask app, for which I use nginx in a docker container.
In the HTML template, I have this ref, using the url_for function
<script type=...
0
votes
0
answers
34
views
flask-scoketio: emitting from an external process without a message queue
I am developing a project using flask, flask-socketio, and the Multiprocessing python libraries.
My site runs on localhost (127.0.0.1:5000).
The goal is to update the html template every second from ...
0
votes
0
answers
35
views
I my flask app data store as json file when we refresh the page then all admin page data will disappear but store in the database fix this problem?
Frontend not connected to backend saving API
The “Save Application” buttons (like saveRegularApplication()) only push data into a JS array applications[] — they never send it to the backend /save-...
0
votes
1
answer
53
views
Import error on Flask CRUD App from import Modus from and url_decode
I am trying to develop a CRUD app using flask. The API is a simple REST API using add, update, delete and show.
from flask import Flask, render_template, redirect, url_for, request
from flask_modus ...
0
votes
0
answers
67
views
Intermittent ESC/POS Printer Issue Using Flask + Gunicorn on Raspberry Pi
I originally had a Raspberry Pi running Raspberry Pi OS (Full Desktop) with Apache serving a Flask app on port 80:
from flask import Flask, request
from escpos.printer import Usb
app = Flask(__name__)...
1
vote
0
answers
83
views
Memory Leak in Flask-SQLAlchemy 2.5.1 with SQLALCHEMY_RECORD_QUERIES - sqlalchemy_queries List Growing Indefinitely
Environment
Flask: 2.0.3
Flask-SQLAlchemy: 2.5.1
SQLAlchemy: 1.4.41
Deployment: Gunicorn with thread workers
Traffic: ~4 RPS in production
Observed Issue: Memory grows from 35-40% to 90% over 30 ...
0
votes
1
answer
92
views
javascript fetch and redirect through flask view not working as expected
In the html intro to a web app for a scientific study, data is collected through forms.
I added a javascript function that submits the data via the fetch API:
fetch('/prepare/', {
"method":...
1
vote
0
answers
46
views
WebSocket transcripts not received until connection is closed during Locust load test
I’m performing a WebSocket load test using Locust with websocket-client and a Flask webhook that receives transcripts.
The WebSocket connection works, audio chunks are sent correctly, and my backend ...
1
vote
0
answers
83
views
LinkedIn API: “ACCESS_DENIED - Field Value validation failed in REQUEST_BODY: Data Processing Exception while processing fields [/author]
I'm trying to post a job description to LinkedIn using their ugcPosts API through my Flask backend.
I’ve successfully obtained a 3-legged OAuth 2.0 access token with w_member_social scope.
Token works ...
0
votes
1
answer
76
views
Will file logging race conditions in multi-process Flask app crash the Python script?
I have a Flask application running on Gunicorn with 2 workers and 2 threads each (4 concurrent execution contexts). My custom logging function writes to a file without any process-level locking:
def ...
0
votes
1
answer
70
views
Does flask dev server normalize paths?
I was playing a CTF which was about path traversal. The server code was like below:
import flask
import os
app = flask.Flask(__name__)
@app.route("/docs/<path:path>", methods=["...
1
vote
1
answer
72
views
Gunicorn with worker 1 not able to call local API
I have flask app, which we are running using gunicorn.
App structure.
% tree your_flask_app
your_flask_app
├── __init__.py
├── app.py
└── routes
├── __init__.py
├── data.py
└── shared.py
...
1
vote
1
answer
44
views
Confused with simple print() logging in Flask and Gunicorn
Historically, i usually run all of my Flask/Gunicorn apps with the following command in my dockerfile:
CMD ["gunicorn", "app.wsgi:app", "--config", "app/...
1
vote
1
answer
134
views
How to transfer Python variables from one Flask view to another?
I am working on a Flask app constructed as follows:
The starting HTML template, controlled by a view, displays a text box, where the user can enter a SQL request to request a SQLite database ...
0
votes
1
answer
40
views
How do I turn on logs when using Gevent with Gunicorn?
I used to use eventlet to run a flask app on Render.com. It would show detailed logs on render every time an HTTP request was made like GET /socket.io/?EIO=4&transport=polling&t=PcGtd0M HTTP/1....
0
votes
0
answers
34
views
How to retrieve data from a select HTML form to Flask [duplicate]
I'm trying to get a name and date from an HTML form (using Jinja syntax) and im not being able to retrieve any values from the "select" dropdown menus.
I don't know if the syntax for "...
1
vote
1
answer
77
views
Flask not redirecting to Dashboard after login
I am using flask as the backend for my project. I created a login form with html and a route in flask. I am using Mysql as the database. When I fill in the form and click log in, the page is just ...
1
vote
1
answer
76
views
Forward a Websocket connection using Flask
Our app works as follows:
Multiple remote machines connect to a central server using SSH connections
The central server has various Python processes which process data sent over these SSH connections ...
0
votes
0
answers
73
views
How to load environment variables in PythonAnywhere?
I have just finished working on a Flask web application that is using openai SDK.
Locally everything works smoothly, but after uploading the project on PythonAnywhere, the environment variables from ....
0
votes
0
answers
54
views
Flask + gspread: multiple Google Sheets API calls (20+) per scan instead of 1
I’m building a Flask web app for a Model UN conference with around 350-400 registered delegates.
OCs (Organizing Committee members) log in.
They scan delegate IDs (QR codes or manual input).
The ...
1
vote
0
answers
60
views
Python Flask app connected to Cassandra Astra DB RAM memory issue
I'm running a minimal Python Flask app with one API endpoint which make a simple call to retrieve data from the a Cassandra Datastax DB inside a for loop.
# Day-2-Day Power
@app.route("/d2d_new_2/...
1
vote
1
answer
89
views
win32com.client Dispatch can't find Crystal Reports
I'm making a React app with a Python/Flask back end. The user enters some information, this is sent to a python script that enters it into a crystal report, the report is generated & saved as a ...
1
vote
1
answer
61
views
Flask SQL model missing one positional argument
from flask import (Flask, render_template)
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://user:password@localhost/database'
db = ...
0
votes
0
answers
59
views
I cant delete data I have typed into my data fields
When I in put data into my fields then maybe I have type the wrong thing, when I press the delete button the data is not erased from the fields. There is no movement of the course backwards hence i am ...
0
votes
1
answer
54
views
Stream response with Python and Flask
I was having some issues with my Flask app when some requests ended up using too much memory to send a response with all the data in just one go, reading the flask docs it says i can stream the ...
0
votes
0
answers
64
views
Connection pool in oracle python is taking a lot of time to execute insert/update query
self.connection = oracledb.create_pool(
protocol=self.protocol,
host=self.host,
port=self.port,
service_name=self.service_name,
ssl_server_cert_dn=self.ssl_server_cert_dn,
user=...
1
vote
1
answer
97
views
Using pybabel to translate tooltip text inside a HTML tag
I've basically finished translating my flask frontend into a lot of different languages but there are a couple of tooltips that I just can't seem to figure out. Technically, these need to be strings ...
1
vote
1
answer
67
views
Flask Post api not returning created object data as response
I am writing a flask sample application in which I have the following model and schemas.
PlainStore schema is as following:
class PlainStoreSchema(Schema):
id = fields.Str(dump_only=True)
name ...
1
vote
1
answer
86
views
URL getting rewritten when using Kubernetes ingress alongside Flask
I want to access two services with my Kubernetes ingress, and both services are based upon a Flask app. Each Flask app is made of a main.py script and a index.html web page, which is rendered using ...
1
vote
1
answer
85
views
Google Cloud Run Using Flask
I am trying to run some functions that collect data from GCS buckets to BigQuery using Flask. I have deployed the API successfully on Google Cloud, but whenever I do a GET request on the home page, it ...
0
votes
1
answer
103
views
Debugging Flask in Cursor Git Worktree Environment with Poetry Not Working
Interesting pre data:
I had no problem debugging in cursor before I created a git worktree of my repo
Issue Details:
After creating a git worktree I now how a separate .venv in both worktrees
I ...
0
votes
0
answers
77
views
Flask ML App Stuck on "Loading" Status Despite Successful Model Training
I'm deploying a Flask ML application with book recommendations to Render, but I'm experiencing a persistent issue where my health endpoint always returns "model_loaded": false, "status&...
2
votes
2
answers
59
views
SyntaxError in flask_humanify
I get this Syntax error after installing flast_humanify
Traceback (most recent call last):
File "once.py", line 29, in <module>
from flask_humanify import Humanify
File "/...
-3
votes
1
answer
86
views
Input in flask route
I am using Flask route to get an user information.
I wan to use input function or somethink else to retrieve a answer from a user in the terminal.
Here is the server I use:
def ask_input(prompt, ...
1
vote
0
answers
110
views
Receive Error 400: redirect_uri_mismatch when trying to use OAuth
I am using Render.com to deploy online a flask app. I want it to first login using Google OAuth before accessing the website. However, I must be doing something wrong because it does pull up the "...
0
votes
1
answer
126
views
Authenticating a user with NextCloud using oauth2 with authlib in flask fails at getting access token
I am writing a flask app that authenticates users via oauth2 with a NextCloud instance (and later will use file synchronisation). From what I read this should be fairly straightforward. For example ...
0
votes
0
answers
79
views
Starting server to get Cesium terrain height only works one time
I have multiple datasets with coordinates in them and I want to plot these points in Cesium for Unreal. For me to do that, I need to correct terrain heights and I want to have them in Python (since I'...