Questions tagged [flask]

The tag has no usage guidance.

49 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
2answers
1k views

Finance: UNIQUE constraint failed: users.username

I've been struggling with this for days. Ignore the '1234' hardcoded into the "insert into" line, just using that to isolate problems. The problem I'm facing is with the username being ...
1
vote
1answer
604 views

Having Issues Setting up Flask Server in Project 1

I am having trouble setting up my flask application in Project 1. Here is some additional screenshots of the error messages I get in browser when running flask. Here is some additional info: Running ...
1
vote
0answers
1k views

Serve pure html files without jinja in flask

As I am making my final project I get stuck at some points where I don't wish to use jinja as I wish to have my html file as a whole without extending any layout html file. In flask render_template ...
1
vote
0answers
58 views

NoAppException in PSET8: Mashup

I am unable to start working on PSET8 Mashup, when I view the web page after running flask I get what appears here: Although I am running flask in the directory of mashup. So I don't know why it can'...
0
votes
0answers
11 views

AttributeError: 'function' object has no attribute 'method'

Hey guys I've been working on my final project. I keep running into this error When I run flask, this error occurs File "/home/ubuntu/project/app.py", line 88, in login if request.method == &...
0
votes
0answers
7 views

Unable to update the database in flask

I am building a CRUD application for student records but my update functionality is not working. I am trying to update the record by using the update query, it is not giving error but its not updating ...
0
votes
0answers
12 views

cs50 Finance Invalid Syntax on function declaration

When working on Finance I encountered a syntax problem which higlights a function declaration def buy(): ^ SyntaxError: invalid syntax. I have a feeling that because such an obvious thing was ...
0
votes
0answers
12 views

Finance: how does the "errorhandler" work?

I am trying to understand the errorhandler function in pset9 finance. In the given application.py: # Original version def errorhandler(e): """Handle error""" if ...
0
votes
0answers
23 views

Error in chreck50. No module named 'flask_login'

Results for cs50/problems/2021/x/finance generated by check50 v3.3.0 :) application.py exists :| application starts up check50 ran into an error while running checks! ModuleNotFoundError: No module ...
0
votes
0answers
42 views

ADD EXTRA CASH IN FINANCE

Trying to add extra cash to my pset finance. I have made as you can see below in the picture, that is adding an extra part of code to the index function(), but I'm just getting a 404 answer. Why is it ...
0
votes
0answers
11 views

When I am Running The Flask It works fine but when I am Opening it is Showing 500 Internal Server

from flask import Flask, render_template, request app = Flask(_ _Name_ _) @app.route("/") def index(): return render_template("index.html", name=request.args.get("name&...
0
votes
0answers
27 views

Week 9 - Finance. How could I check de return?

I am coding the week 9 problem (Finance) and I am part of (quote) and I have some doubts. The lookup () function returns (none) if the API does not find (stock). I am interested in how I check using ...
0
votes
0answers
84 views

Pset9 Finance| "Index table" doesn't display all the companies

I'm doing pset9 "Finance" and I've designed the two tables in the database, one with purchases and the other with transactions. Now when I render the index page, the shares of only one ...
0
votes
0answers
155 views

What's wrong with my register function? (Pset9 - Finance)

Here's my register function in application.py: @app.route("/register", methods=["GET", "POST"]) def register(): """Register user""" ...
0
votes
1answer
36 views

Can't update shopping cart for more than one item, works fine for a single item, otherwise only the first one gets updated

I am trying to update the quantity of the products in the shopping cart by changing the number in the dropdown. If the cart has two or more items then only the first one works and the qty doesn't ...
0
votes
0answers
266 views

Problem with endblock tag in finance. "endblock" tag unknown

{% extends "layout.html" %} {% block title %} Quote {% endblock %} {% block main %} <form action="/quote" method="post"> <div class="form-...
0
votes
0answers
3k views

raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@app.route('/api/<string:isbn>', methods = ['GET']) def isbn(isbn): #import api from Goodreads (stats) book_data = db.execute("SELECT * FROM books WHERE isbn=:isbn",{'isbn':isbn})....
0
votes
0answers
21 views

Final Project: dynamic page creation to show just 10 SQL entries per page

I'm developing a web-page for my CS50's Final Project for contacting japanese students around Argentina. The only official japanese exam takes place in Buenos Aires, and there are no many good places ...
0
votes
1answer
226 views

RuntimeError: missing value for placeholder (:name)

all! I'm doing the final project, and I have a form whose contents I'm trying to submit to a database. My python code is: @app.route("/Contact.html", methods=["GET", "POST"]) def Contact(): if ...
0
votes
0answers
19 views

Join table seems showing an error

I tried this statement on the adminer postgreSql database online database query tool and works but when i try to code it into my FLASK app showing nothing. lists = db.execute("SELECT b.isbn,b.author,...
0
votes
1answer
41 views

problem with nesting sql queries in flask (final project)

I've been trying to only insert new ids if they weren't inserted before in my database but the problem I've been having is that I couldn't get the nested queries to work in python flask. Whatever I do ...
0
votes
0answers
46 views

Trying to flask run the task session on the CS50 web Lecture DATABASE issue

I had a great time learning about HTML and CSS. Then came this intimidating flask feature. I was able to create a session["username"] to login and logout. I'm trying to use session to create a todo ...
0
votes
1answer
173 views

Unsure of what my DATABASE_URL is

I am using windows 10 (64-bit) and am following the course "Web Programming with python and Javascript" in CS50, in which i wanted to use my computer as a local host to store the table content. I am ...
0
votes
0answers
28 views

Deleting SQL dynamically with Flask

I want to delete a specific row in my database but I don't know how to do it. On my HTML I have this: <div class="cases"> {% for row in rows %} <div class="card border-success mb-...
0
votes
0answers
2k views

(psycopg2.errors.UndefinedTable) relation "users" does not exist

when i try to load up regster.html i get this error "sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "users" does not exist LINE 1: INSERT INTO users(username,password) ...
0
votes
0answers
465 views

CS50W: "flask.cli.NoAppException" Can anyone explain this?

flask.cli.NoAppException: While importing "application", an ImportError was raised: Traceback (most recent call last): File "c:\users\hp\appdata\local\programs\python\python38\lib\site-packages\flask\...
0
votes
1answer
952 views

error while trying to update database using python and sqlalchemy

While I was trying to run create.py file having the following code: import os from flask import Flask, render_template, request from models import * app = Flask(__name__) app.config["...
0
votes
0answers
85 views

How to ensure proper database url in environment variable?

I am trying to run the code from lecture3 and I am having trouble ensuring the database url is properly set using the environment variable. Here's the code: db_url = 'postgresql+psycopg2://{username}:...
0
votes
1answer
94 views

Error in Flask application

Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application. below is the code in ...
0
votes
1answer
29 views

finance: how to build an "active" table

I wish to know how to build a table (in HTML) where the row expand with the row I input on it. For a static table I've used: <table style="width:100%"> <tr> <th>Symbol</...
0
votes
0answers
46 views

Textbook for understanding session in flask or in general web development?

Is there any good text book available which can explain the concept of session in web development ?
0
votes
1answer
127 views

CS50 Web Development Project 2 Attribute Error: module 'engineio' has no attribute 'WSGIApp'

This is my first time trying to run flask on Linux, I've made projects 0 and 1 in Windows 7. I've been able to run Project 2 on Windows, right before I switched to Linux. As I enter "flask run" on the ...
0
votes
1answer
100 views

cs50web socketio : broadcast does not include the sender

I work on ubuntu 18.04. I set up a virtual environment so that I am sure to work with python3 according to the instructions found here:https://vitux.com/install-python3-on-ubuntu-and-set-up-a-virtual-...
0
votes
2answers
2k views

How to pass value from HTML to python?

I'm setting up a new project in python ,and want to setting up a web pageresturant.html using FLASK , this code in html get the selected value from drop down box when button is clicked ,how can i pass ...
0
votes
1answer
356 views

Cannot run Flask - TypeError

Whenever I try "flask run" I get this error in the IDE. I have no idea what the problem actually is. ~/workspace/pset7/survey/ $ flask run * Serving Flask app "application.py" (lazy loading) * ...
0
votes
1answer
700 views

AttributeError: __enter__

I defined a table in python using sqlalchemy but when i try to create it this error appears
0
votes
2answers
358 views

Can't Connect Python Flask With PSQL Database

every time i try to make connection between python and PSQL this error disappear ?
0
votes
1answer
487 views

Final Project - Problem uploading files to IDE folder

Update: Does anyone know hot to get the folder's absolute path? It isn't ~/workspace/fp/documentos/ or any of it's variations, such as /workspace/fp/documentos/ or workspace/fp/documentos/. It seems ...
0
votes
1answer
4k views

Unable to run Flask App using Anaconda Prompt.Do Anaconda support Flask?

I am using Anaconda for editing and running scripts. In Anaconda prompt/command prompt, when I type this command : export FLASK_APP=application.py I am getting the error: "'export' is not recognized ...
0
votes
1answer
207 views

please help ! till yesterday my app was working almost fine but today its not even starting ! can someone pls explain this to me?

flask.cli.NoAppException: Failed to find application in module "application". Are you sure it contains a Flask application? Maybe you wrapped it in a WSGI middleware or you are using a factory ...
0
votes
0answers
409 views

flask redirect(url_for("endpoint")) navigates me to ide50blabla:8080/myEndpoint instead of https://ide50blabla:8080/myEndpoint

I submit a file in my js file : $('#myForm').trigger('submit') That file is sent to and endpoint and there I redirect to another endpoint where stuff is done, the page is rendered again with ...
0
votes
1answer
160 views

Blocked loading mixed active content EM after ajax post request to a flask app

In my browser I see the url and it starts with "HTTPS ://ide50etc". I get the EM however that says "loading... HTTP ://ide50etc". Why does it do that? It doesn't happen all the time. When my session ...
0
votes
1answer
266 views

Uploaded images cannot be rendered in html of flask app

I'm making an app that uploads images and sounds. That had been working very well for a long time. But now suddenly pictures can't be rendered in the html any more after having been uploaded.In cloud ...
0
votes
1answer
38 views

I need a hint how to fix this form

The issue is the Delete Buttons are not working well, so if I am clicking on Delete Title 1 is deleting Title 1 if I am clicking on Delete Title 2 is deleting Title 1. This is the code: @app.route(...
0
votes
1answer
81 views

Why flask is returning a default login page instead mine, custom one

I have an issue with my app, since I was adding the feature "users roles" I am getting a strange page content on login page looks like default login page instead of my custom login page and I cannot ...
0
votes
1answer
125 views

Final Project with Google Maps ERR_EMPTY_RESPONSE reply for index

I am working on my final project using Google Maps to make a game, and I keep running into the same error: ide50-ssk4988.cs50.io didn’t send any data. ERR_EMPTY_RESPONSE This always seems to happen ...
0
votes
1answer
188 views

Flask run application.py chart is alwys yellow

How the hell this flask works? I made application.py looks like this: from flask import Flask, redirect, render_template, request, url_for import os import helpers from analyzer import Analyzer app ...
0
votes
1answer
166 views

Rectify implementation of register function in pset7 - finance (Flask)

def register(): """Register user.""" if request.method == "POST": if not request.form.get("username"): return apology("must provide username") elif not request....
0
votes
1answer
278 views

"No name 'redirect' in module 'Flask'

I am attempting to run the program from lecture 8, but I am experiencing errors with statements on line 1 and 9. I am using the CS50 IDE on Cloud9. I have tried the following: Downloaded my ...