flask

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

TypeError: missing 1 required positional argument, argument is already defined

TypeError: missing 1 required positional argument, argument is already defined Question: first off if you’re reading this, thank you very much. It’s my first time posting here. I’m a bit new to Flask and Python as a whole. I’m trying to create a query to check if the user has reserved or not a class. …

Total answers: 1

Cannot activate virtual environment in vscode

Cannot activate virtual environment in vscode Question: I’ve made a virtual environment that looks like this: When I run the following line it gives me an error: PS C:UsersuserDocumentsCodeflaskTutorial> envScriptsactivate But when I run this line nothing happens? PS C:UsersuserDocumentsCodeflaskTutorial> envScriptsactivate.bat I’ve read that windows doesnt run .bat files, but how do I activate my …

Total answers: 2

"cannot import name 'EVENT_TYPE_OPENED' from 'watchdog.events' "

"cannot import name 'EVENT_TYPE_OPENED' from 'watchdog.events' " Question: I’m trying to make a REST api (begginer) but when i tried to initialize the server from this code: from flask import Flask app = Flask(__name__) if __name__==’__main__’: app.run(debug=True, port=4000) i get this error in the prompt: from watchdog.events import EVENT_TYPE_OPENED ImportError: cannot import name ‘EVENT_TYPE_OPENED’ from …

Total answers: 3

How to show image from body of post request in flask api?

How to show image from body of post request in flask api? Question: I am trying to display the image captured from the browser/html canvas. A user would basically draw something, and I want to send it to my flask api so i can further process it with opencv, but i am having trouble just …

Total answers: 1

How can I render new Template with Flask Socket-IO join event?

How can I render new Template with Flask Socket-IO join event? Question: I’m programming a litte multiplayer game with Flask Socket-IO. If the client is on the website, he connects to the websocket. On the start page the client should type a nickname in the field and press the button. Then the client tries to …

Total answers: 1

YouTube Core Error Domain: Service Unavailable

YouTube Core Error Domain: Service Unavailable Question: I have a Python script that uses the YouTube API to add a video to a playlist that I created. Some of the time the function works, but other times, when I try to execute the request, I get this error message: googleapiclient.errors.HttpError: <HttpError 409 when requesting https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet&alt=json …

Total answers: 1

Python Flask distinct two generics routes

Python Flask distinct two generics routes Question: In python flask I have two routes with approximately the same behaviour to redirect on another service. The first one is to redirect a generic request to another API. @app.route(‘/factory/<path:url>’, methods=[‘GET’, ‘POST’, ‘PUT’, ‘DELETE’]) @cross_origin() def request_factory(url: str): resp = manage_factory_message(request) return app.response_class( response=resp.content, mimetype=resp.headers[‘Content-Type’], status=resp.status_code ) And …

Total answers: 1