Most voted "flask" questions
Flask is an MVC microframework written in Python based on Werkzeug and Jinja 2 (and good intentions, according to the official website).
Learn more…176 questions
Sort by count of
-
0
votes1
answer23
viewsFilter model datetime Django
I have a model that is basically the following : class Sample(models.Model): date = fields.DateField(auto_now=True) Now, with this I want to filter only the month in this model How I only get the…
-
0
votes1
answer356
viewsHow to use the Len function in a python template - Flask
I have an Appweb in python-Flask that would like to show the amount of players online, only I’m a little lost in this part already tried {% Len(date) %} and {% data|length %} and no two methods…
-
0
votes0
answers63
viewsError : Pending Templatenotfound
I want to create a basic application, but I’m not able to render Project structure ├── Project │ ├── Controllers │ ├── __init__.py │ ├── __init__.pyc │ ├── Models │ │ └── Conexao │ ├── templates │ │…
-
0
votes1
answer504
viewsHow to upload a Flask server in 0.0.0.0:80 on Ubuntu 16.04 Linux with python3 on an AWS EC2?
I need to run a Flask server in an EC2 instance. For this we need to solve these two steps: Open that door in EC2 Make Flask rotate in 0.0.0.0:80 The first step is ok. The door is open to interet:…
-
0
votes0
answers29
viewsError importing Sqlalchemy
I cannot import flask_sqlalchemy even after installing from flask import Flask, render_template from flask_sqlalchemy import SQLAlchemy ^aqui mostra o erro: ImportError: "flask_sqlalchemy" could not…
-
0
votes0
answers159
viewsQ: SQL login check ALCHEMY Pending
I am creating a login to give access to the tool I am starting to create, the database is SQL Server The structure of the project is this: ├── Project │ ├── Controllers │ │ ├── __init__.py │ │ └──…
-
0
votes1
answer35
viewsFlask application deploy error
I am trying to deploy a flask application in the same way I do when using python2.7, but in this case I am using python3 and an error is returned in wsgi. Below follows the first line of apache2…
-
0
votes0
answers16
viewsI would like to know the concept of Querystring , what is it ? , what is it for ?. I am in a class on flask and was introduced to me about Querystring
@app.route('/novo') #novo.html def novo(): if 'usuario_logado' not in session or session['usuario_logado'] == None: return redirect('/loguin?proxima=novo') return render_template('novo.html',…
-
0
votes0
answers10
viewsWorking with Multiple Flask python Request
Hello, I’m new to developing Python applications using Flask, developed an application using Python and Flask, hosted the application on the Google Cloud App Engine, and came across a problem, in…
-
0
votes1
answer692
viewsCreation of flask-sqlalchemy tables
I am developing a small application in Flask and I am using the extensions Flask-Sqlalchemy, Flask-Migrate and Flask-Script to manage my migrations in the database, follow the configuration of my…
-
0
votes1
answer771
viewsHow do you put a local file to download in flask or python?
had to download a file in python or flask I tried so but I think it just opens the file @app.route("/downloads/", methods=['GET', 'POST']) def orac_detal(): global datas, listaComTudo,…
-
0
votes1
answer154
viewsError in tests with python 3.7, pytest and flask Blueprint
I’m starting a very basic Flask application for learning purposes. The apps are running normally. The problem is testing with pytest. I am using in pipenv: python 3.7.2, Flask==1.0.2,…
-
0
votes0
answers20
viewsRequests in flask for fields with the same name
<div> {% if filmes|length > 0 %} {% for f in filmes %} <form action="/pesquisa_filmes_id", method="POST"> <input type="hidden" id="id_filme", name="id_filme" ,value="{{f}}">…
-
0
votes3
answers69
viewsSQL syntax error in a Flask application
I am developing a game display system, with user login necessary to add games to this list, but when I try to run the query, I get a syntax error. It follows the code that prepares the database (has…
-
0
votes0
answers76
viewsAccess from a dictionary in flask via POST
How could I access a dictionary element using POST in flask? I have lists to simulate a comic and through the POST, I would like to try to access them. Function code:…
-
0
votes1
answer48
viewsjinja2 error: jinja2.exceptions.Templatesyntaxerror: Unexpected '%'
My code is generating a " Unexpected '%' error", all symbols being properly correct. I have a route to show the companies Cnpjs in a list, follows function of the listing below:…
-
0
votes1
answer49
viewsI need a recommendation on how to use bootstrap as template formatting in a Flask app
Hello, this question seems kind of basic but I still haven’t found a consistent answer. I would like to know if, when using Bootstrap as a template formatting in Flaskpy, the best option is via CDN,…
-
0
votes1
answer66
viewsloop for Jinj2 flask
I have a loop 'for" in the template only I want it to show a certain amount result. {% for form in form %} <tr> <td><img src="../static/img/arrow-gray.png" alt=""> <font…
-
0
votes1
answer146
viewsArithmetic calculations (sum) in the Flask-Sqlalchemy database
I have a table in my database that the user places the total flight hours he has done. I wanted to know how to add all the hours of the user who is in the database and show in templates. Backend:…
-
0
votes1
answer118
viewsAttributeerror- Sqlalchemy Flask
'str' Object has no attribute 'contains' I am trying to create a query using Flask-Sqlalchemy Flask should return me a list of books according to the user’s search. It selects 4 search options and…
-
0
votes1
answer328
viewsKeyerror: 'A secret key is required to use CSRF.'
My application is showing error "Keyerror: 'A secret key is required to use CSRF.'", however in my config.py file I have the key created. What else could I check to remedy this error? File…
-
0
votes1
answer34
viewsPython+HTML+Sqlalchemy error
Hello I am trying to do a simple procedure, but I stopped at the problem below. I have the simple goal of passing a parameter and filtering a list of associates. I have the following codes: Python…
-
0
votes0
answers184
viewsredirect is not sent to the browser
I made 3 pages on my website: one to register, one to login and another serving as the home page. I need that after the user registers it is sent to the login, that if successful send it to the home…
-
0
votes0
answers162
viewsI can’t file a request for flask through the angular on apache
[RESOLVED] I managed to solve. I used Proxypass to redirect meudominio/api requests to localhost:8000, and changed the request url in my angular project to meudominio/api, and then it started…
-
0
votes1
answer78
viewsError 404 on second route using Flask
Good morning. I configured my app in Cpanel that uses passenger_wsgi.py (I don’t know if this information is relevant) Python Version 3.7.3 and Flask Version==1.1.1 The main route works well, but…
-
0
votes1
answer56
viewsFlask template with nodejs and webpack
I have no experience with the "new" front-end technologies. I have always devoted more to the back. Question: You can work with flask (Jinja) templates using Node + webpack to develop the front?…
-
0
votes1
answer112
viewsPyhton "No module named" error with local imports
I created a simple App using Flask, but I have a problem when importing the "Resources" that I created into another file. This is the main file: from flask_restful import Api from flask import Flask…
-
0
votes1
answer30
viewsFlask does not expect function return to show view
I have a function that returns values to be shown in the view. In tests on localhost works perfectly, the server waits for the return of this function and only then presents the data on the screen.…
-
0
votes3
answers119
viewsHow do I reset the Flask server using if within the algorithm?
Next, I am creating a game in order to learn, however, I need this game to "reset" when the amount of attempts is reached. At the beginning of the code I have the following: from random import…
-
0
votes2
answers281
viewsQuestion about recovering data from database
Good morning. I am a beginner in programming and had an opportunity in a project at work to become a developer. The project is only a panel showing some database data from our main application. I am…
-
0
votes0
answers36
viewsHow do I dynamically delete a Row with Flask?
Guys I have this code in HTML {% for row in rows %} <div class="card border-success mb-3" style="max-width: 18rem;"> <div class="card-header">{{ row['title'] }}</div> <div…
-
0
votes1
answer138
viewsHow to filter records per month in Python / Flask
Hey, guys. All right? I started learning programming some time ago and took advantage of this quarantine to give a gas and manage to create my first system - a voucher/advance manager. It’s simple,…
-
0
votes1
answer29
viewsEscaping SQL "ILIKE" using bilbioteca psycopg2
I followed that topical here in the stack to try to create a select in which I look for a person using the ILIKE function, but I have the return of "None", even making changes in the column and…
-
0
votes1
answer147
viewsWhat does backref mean in relation tables Many to Many in Sqlalchemy?
I am creating a database template in my models.py for my Flask application. I have a User table, and each user can have multiple instruments, and one instrument can have multiple users. In the…
-
0
votes1
answer93
viewsFunction return
Good afternoon, I have these two cases: I have a modal with <form action="{{url_for('rota')}}" and on this route I am giving an update on the information, my problem is in the return of this…
-
0
votes1
answer146
viewsSerialize in flask-marshmallow with relationship
I’m using the flask-marshmallow to make the serialize in my project. Along with it I am using flask-sqlalchemy for mapping my tables. Follows the structure: models/Area.py: config.database import db…
-
0
votes1
answer63
viewsloop in json in flask using render_template
Hello, I have the following json: {"movies": "[{\"title\":\"Hercules\",\"rep\":99.96},{\"title\":\"In the Dark\",\"rep\":98.12},{\"title\":\"Titas\",\"rep\":96.61}]"} and would like to scroll…
-
0
votes0
answers59
viewsHow to make a unit test using Flask and Django
I’m new to python testing using Django and flask. Using the pytest library, how would test implementation of the following methods and what could be tested? If someone could give me a light it would…
-
0
votes0
answers38
viewsMongodb query optimization for large collection with large documents
I am using Pymongo with Flask and would like to know how to optimize a query as I am filtering within a large collection (2947 documents) with large documents. This is the structure of the…
-
0
votes1
answer136
viewsFlaskform validation with Flask - Form failure.validate_on_submit()
Good afternoon guys, all right? I created a form using the flaskform class, from flask_wtf. I can send it to the front of the application and apparently the behavior is correct. However, when I…
-
0
votes1
answer33
viewsI cannot run an audio player using Flask with Python3.7
Good afternoon! I’m trying to perform a seemingly simple task, which is to run an audio player on an HTML page using an app made in Flask, but I can’t get the player to load the audio. PYTHON APP: #…
-
0
votes1
answer57
viewsDynamic Form with Flask
Hello, I’m creating a website that consists of a teacher creating a quiz and sending it to students to answer, but I’m not finding a way to get the teacher to ask as many questions as he wants. At…
-
0
votes0
answers41
viewsPlay one song at a time on an HTML5 Audio TAG that is dynamically created with the same ID
Good morning! I have a question regarding to be working with audio in a Web application, I have an App made in Python using Flask that sweeps a certain directory that has several MP3, so I create…
-
0
votes1
answer145
viewsUsing IF ELSE JINJA2 Python and Flask
I’m starting web development using Python and Flask, I am trying to change the class of a TAG but analyzing the value I am going through to be reinderized follows below how I am doing to try to use…
-
0
votes1
answer46
viewscss class using jinja2 does not work
I’m trying to put css styles but just took the first block of code in my css style. css style. h1 { color: blue; } .login { display: inline-block; padding: 15px; border-radius: 4%; text-decoration:…
-
0
votes1
answer88
viewsHow to get the current user in the HTML page to insert in the Flask Python database
Hello I need to get the user who is logged in to the system for when he does an Update or Insert in the database enter his record, currently in the template I can already get the user name with this…
-
0
votes0
answers16
viewsHow to use the session (cookie) of another site that was not set by flask
I wonder if there is a way to use a cookie set by another site, in my application in flask with python. I need to authenticate on a site that requires the A3 token, but I can’t capture this token…
-
0
votes1
answer59
viewswhen trying to create a bank with flask_sqlalchemy Attributeerror: can’t set attribute
Making a Flask app, I had some difficulties with the database, and followed the following steps in VSCODE: I created a virtual environment, installed via Pip flask and other libs I created the first…
-
0
votes1
answer62
viewsHow to receive and send data from an React application to a Flask API?
I am making an app in React and would like to use Flask to save user data in a local database. I was able to make React and flask "run on the same door" and thus enable a connection between them.…
-
0
votes1
answer36
viewsAttributeerror: type Object 'User' has no attribute 'order_by' - Sqlalchemy
I am trying to sort the Transaction table id accordingly: from sqlalchemy import desc from sqlalchemy.orm import query from website.models import Transaction def home(): transactions =…