Questions tagged as 'flask'

2
answers

Help with Python cycle

Someone could explain to me the process that carries out the following line of code (see the image for more details). Specifically, this one: langs = [language for language in languages if language['name'] == name] I have already tried t...
asked by 29.07.2017 / 11:40
1
answer

Optional routes in Flask

Is there any way to make optional routes? For example: @app.route(r'/contacts/<key>/<name>?', methods=['GET']) def contact_deatils(key, name = None): print(key, name) return 'mensaje de prueba' if you place parameters...
asked by 26.03.2018 / 23:26
1
answer

Jinja2 check if a value exists in a list of dictionaries

I'm trying to check if a value exists within a dictionary list. Use flask 1.0.2. See the example below: person_list_dict = [ { "name": "John Doe", "email": "[email protected]", "rol": "admin" }, {...
asked by 07.09.2018 / 18:18
1
answer

How to define the host and port to use in a Flask app?

To execute an application in Flask we use the method app.run() In this method we can pass configuration parameters, among them: host, port, debug By default, the Flask application runs in host = localhost port = 5000 So, if we wan...
asked by 17.03.2018 / 06:02
1
answer

I need to dynamically pass to the "query" object of SQLAlchemy the parameters of the class next to its attributes

I need to dynamically arm the part where the .query() gets the class of the objects and their attributes, that is, that within query dynamically insert the tables and columns received from another application. For example: sessio...
asked by 19.09.2016 / 17:17
1
answer

Failed to decode JSON object when calling GET request with Flask Python

I try to send a GET request after sending a message to a server, but I receive an error. I think it's because @app.route('/chat',methods=["POST"]) def chat(): try: user_message = request.form["text"] response = requests.pos...
asked by 06.06.2018 / 14:53
1
answer

Join in sqlalchemy

I am trying to pass a query that I have made - and I already tried it in SQL - to SQLAlchemy in python using Flask. This is the query in SQL: select Reclamo.IdReclamo from Reclamo,ServicioAsignacion,ReclamoServicioAsignacionAfectado where S...
asked by 23.09.2016 / 17:00
1
answer

Why using flask_login despite connecting to the system that is disconnected at random when making a page change?

I am using Flask for an application, it is deployed on an Ubuntu server with NGINX and GUNICORN. The problem that occurs is that although I enter the system correctly using the login form, when wanting to access any other page or even updatin...
asked by 12.12.2018 / 20:08
1
answer

Pymongo find by _id field

I'm trying to check my Mongo database to find a value for the "_id" field with the value returned by the url_for () function from the template. Although I have verified that the value that appears in the URL and the one that passes to the router...
asked by 04.12.2018 / 16:24
1
answer

Refresh in current date fullcalendar

I am working with full calendar but I have a problem, my calendar has data since 2016, and it is required to change several of the events, implement the edit event, all good, but the problem is that when I save a data and I'm in 2016, the page i...
asked by 08.12.2017 / 19:17