flask

Retrieve image name in python from form

Retrieve image name in python from form Question: on the contnue of the my prevous question : find answer i have fixed hmtl code and it is here : <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Select image</title> </head> <body> <form action="{{ url_for(‘image_shape’)}}"method="post"> <label for="img">Select image</label> <input type="file" id="img" name="img" accept="image/*" onchange="displayImage(this)"> <br> <img id="selectedImg" …

Total answers: 1

immediately throw sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query')

immediately throw sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query') Question: I encountered a very strange issue where I consistently receive the following exception at a fixed point in my test data when using the db.session.execute(‘insert into table_a select * from table_b where xxx’) statement within a loop. sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, ‘Lost connection …

Total answers: 1

Flask application, db.create_all() does not create the database

Flask application, db.create_all() does not create the database Question: I’m new in creating Flask applications and I’m following a tutorial to quick start. I see that this question about db.create_all() is frequent, nonetheless I can’t understand why I can’t create a database. my project structure I’m initializing the dataset in __ init __.py as follows: …

Total answers: 1

Python 3.x/Flask – Using Cloudwatch handler throws CORS error when login in

Python 3.x/Flask – Using Cloudwatch handler throws CORS error when login in Question: I’m working on a project that uses flask w/ python 3.10 and react. Everything works fine, but the logs were a local file and we decided to move it to Cloudwatch. Wrote the code, changed the loguru sink, everything seemed ok, It …

Total answers: 1

Gunicorn3 goes to the development server

Gunicorn3 goes to the development server Question: When I open a server with gunicorn for my flask app, it automatically opens the development server of flask, without giving me any errors: $ gunicorn3 –workers=1 main:app [2023-10-16 19:46:13 +0000] [1061] [INFO] Starting gunicorn 20.1.0 [2023-10-16 19:46:13 +0000] [1061] [INFO] Listening at: http://127.0.0.1:8000 (1061) [2023-10-16 19:46:13 +0000] …

Total answers: 1

ImportError: cannot import name 'url_quote' from 'werkzeug.urls'

ImportError: cannot import name 'url_quote' from 'werkzeug.urls' Question: Environment: Python 3.10.11 Flask==2.2.2 I run my Flask backend code in docker container, with BASE Image: FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime But when I run the pytest with version pytest 7.4.2, pip install pytest pytest it raised an Error, with logs: ==================================== ERRORS ==================================== _____________ ERROR collecting tests/test_fiftyone_utils_utils.py ______________ ImportError …

Total answers: 6

How do I update the password?

How do I update the password? Question: I am working on a web app and I want a user to be able to reset their password but I’m failing to do so how can I do it? I also tried email = request.form.get(’email’) new_password = request.form.get(‘password’) user = User.query.filter_by(email=email).first() If user : user.password = new_password. …

Total answers: 1

Flask MVC with Circular Dependency (dependency injection?)

Flask MVC with Circular Dependency (dependency injection?) Question: I’m trying to create models to form the mvc in flask but it’s marked as a circular dependency (db in init), I even removed the models to test and put them in for the controllers to use the bank, but the result was the same, what could …

Total answers: 1