flask

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

NGINX Configuration Issue: One Domain Works, Another Doesn't

NGINX Configuration Issue: One Domain Works, Another Doesn't Question: I’m facing an issue with my NGINX configuration where one of my domains works correctly, but the other doesn’t. I have two domains (domain1.site and domain2.site) with their respective configurations in NGINX. Here’s the NGINX configuration for domain1.site: server { listen 80; server_name domain1.site www.domain1.site; return …

Total answers: 1

Displaying database information in HTML using Flask, Jinja2, Python and SQLAlchemy

Displaying database information in HTML using Flask, Jinja2, Python and SQLAlchemy Question: I’m trying to display information that I tried inserting into a model on my Flask HTML site. I can’t figure out how to do this because the code doesn’t seem to display anything on the page. Here’s my model: class Book(db.Model): id = …

Total answers: 2