55,185 questions
0
votes
0
answers
31
views
Flask Subdomain Routing Not Working Correctly After Deployment on Render.com
I'm stuck with an issue on how to properly set up subdomains in my Flask project. Here's a simple example of the code I'm working with:
from flask import Flask
app = Flask(__name__)
app.config['...
1
vote
1
answer
91
views
Is there anything I need to do to make session data persistent across routes in Flask
I am working with a Flask project with React as front-end. I just completed the authentication work. When i tried to access the user_id which i stored in session as 'user_data' from another route via ...
1
vote
2
answers
70
views
How to log/display app name, host and port upon startup
In my simple Flask app, I've created the following .flaskenv file:
FLASK_APP=simpleflask.app
FLASK_RUN_HOST=127.0.0.1
FLASK_RUN_PORT=60210
Now, I would like my app to log the following message upon ...
0
votes
1
answer
85
views
Nixos - Flask - ModuleNotFoundError
I wanted to add a form to my flask-based website, but I got the following error message:
Apr 24 21:18:04 nixos uwsgi[2261]: from flask_wtf import FlaskForm
Apr 24 21:18:04 nixos uwsgi[2261]: ...
0
votes
1
answer
64
views
WeasyPrint in Flask server not generating PDF with images
I have a Flask server running in localhost python 3.9 and conda, with a route for pdf creation with WeasyPrint's python driver, the pdf's are generated correctly but I just cant put any images on it (...
0
votes
0
answers
73
views
Flasgger displaying Swagger page locally, but fails to load API definition on Azure
When I run this locally, the swagger page loads as normal, with all my endpoints and tests effectively. However, when I send it to Azure, I get the following page:
Failed to load API Definition.
When ...
0
votes
0
answers
46
views
python flask web app "application root" settings error
i try publish my site but i cant. yes we can see
"It works!
Python v3.9.21"
message but its only i can see this. i think my wrong "application root" value. my file manager ...
0
votes
1
answer
25
views
Flask: Blueprint.get_static_file(filename) vs dynamic url_prefix
Question
How can I make a static lookup work if the url contains additional variables?
Example
When I use a blueprint (id) with a dynamic url_prefix (<int:id>):
# /a/__init__.py :
a_bp = ...
1
vote
0
answers
35
views
No text message in logs or console when my flask app runs in a container
I am currently packaging an old python/flask/pandas application (MyApp) into a podman container.
When MyApp runs directly in Ubuntu Console, text messages (e.g. user defined warnings and errors from ...
0
votes
1
answer
124
views
PyMySQL mogrify not taking list of dicts as argument
I'm trying to simply log my queries and their parameters using the pymysql.cursor.mogrify() function as detailed in the documentation.
python-1 | INFO:__main__:Creating records.
python-1 | INFO:trex....
2
votes
1
answer
51
views
Form causes an unsupported media format error
I'm working on a todo app for a class project and the /add_todo route returns a 415 error code whenever I try to add a todo.
@app.route("/add-todo", methods=["GET", "POST"...
1
vote
0
answers
48
views
Switched from Flask to FastAPI CSS stopped working
I had a Flask application, but I switched to FastAPI and noticed that only Bootstrap styles work. And the CSS styles, even the checkbox style="", are not applied. But the old CSS styles ...
0
votes
1
answer
35
views
Purpose of a multistage Docker build for Flask app Container
The following Dockerfile is part of an example of a simple Flask deployment published on Docker offical Github:Docker Github
FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder
WORKDIR /app
...
0
votes
1
answer
170
views
Flask-smorest get rid of "Default error response" from OpenAPI page
The method doesn't return errors responce and I'd like to remove default error responce
from flask.views import MethodView
from flask_smorest import Blueprint
from schemas.items import ItemsSchema
...
0
votes
0
answers
50
views
running two Flask apps through WSGI on Apache Ubuntu Server?
I have 2 apps made in Flask, an API which gets and sends data from an sqlite database. And a Flask web app with a jinja template in a template folder. i want to run both the api and web app on an ...
0
votes
0
answers
46
views
when i run my flask services, in docker it is connecting well but when i hit the api it is shoing error in docker
i have multiple services in flask which is at same port 5000, but host name is different so run the multiple end points i used docker and when i created images on docker it is showing an error as ...
0
votes
0
answers
14
views
Accessing A flask app running inside a docker container in a windows host
I am trying to access app running inside the docker container but it always displays this site cant be reached.
the same settings for the flask app and the docker container in a linux host works just ...
0
votes
0
answers
58
views
error using jinja and flask in external javascript file
We are being required to move all css and javascript to external files.
The css works fine. The javascript files only works in a particular way which is not approved.
The following line works:
'''...
0
votes
0
answers
19
views
All handlers are called multiple times when the response code is not 200
@app.errorhandler(404)
async def page_not_found(e):
return render_template("404.html"), 404
The handler is executed 3 times even if render_template throws an exception and returns 500
...
1
vote
0
answers
29
views
In the flask app when i added caching is showingerror in frontend
This is my flask route in which i have used falsk-caching
@app.route('/get_subject',methods=['GET'])
@jwt_required()
@cache.cached(timeout=20)
def get_subject():
current_user = get_jwt_identity()
...
0
votes
0
answers
20
views
How to protect Python Flask Blueprints pages with Azure authentication
I have got an app which authenticate using Azure AD. If I browse to / or /page then it prompts to login, how do I protect other pages/blueprints i.e. profile page?
app.py
import os
import requests
...
2
votes
1
answer
76
views
Flask Backend on Vercel Returns 404 for All Endpoints, Next.js Root Page Fails to Load
I'm building my project from this template. When I deploy, I'm encountering persistent 404 NOT_FOUND errors for all Flask endpoints (e.g., /api/news-galore, /api/raw, /api/) and the root page (/) of ...
1
vote
0
answers
38
views
Selenium Chrome headless mode times out on first run, but works fine after running in headed mode once – why
I'm using Flask to run a local web server and using Selenium with Chrome in headless mode to automate a task via Python.
However, when I run the Selenium script in headless mode, it times out when ...
1
vote
1
answer
62
views
Flask - Problem with passing variables between routes OR with sessions
I have been struggling with this for nearly a week.
I am learning Flask, building an application for collectors. Collectors can view the database, but can add/edit only after login. The app requires ...
0
votes
0
answers
45
views
Bad request version/syntax/type when executing POST request to flask
Good Morning,
I'm trying to set up a local flask app running for testing some python code, i used to do it the same way a lot (with the same python script) without any issues, but now i'm getting ...