Questions tagged [flask]
The flask tag has no usage guidance.
118 questions
0
votes
1
answer
74
views
Problem with Updated CS50 Finance - all API calls to lookup stocks come back as None
I'm a high school teacher and have been teaching CS50 AP for about 7 years now. I like to make sure that I have a handle on all of the problem sets before going over them with my students. So, when I ...
0
votes
0
answers
65
views
PSet 9 check not working
Evening,
I am getting the following error trying to run check on PSet9. I have downloaded a new empty version tested that and get the same error. I'm thinking this is a fault on the CS50 side but if ...
0
votes
2
answers
120
views
PSet 9 Sell handles valid sale expected to find "56.00" in page
Like others I have become stuck with the above error, although the site seems to display the correct info, any help would be appreciated:
Python Flask Code:
@app.route("/")
@login_required
...
1
vote
2
answers
72
views
Week 9 - Finance - Foreign Key Mismatch
I'm trying to solve this issue for a week and nothing works! in my /buy route, I cannot update the users table with updated cash after a "buy" order is submitted. Here is an example of what ...
0
votes
1
answer
38
views
why does "world" not show up when did not enter name in the form?
i followed the instructions very closely. When i do enter a name it works just fine. However, when i do not enter it, "world" did not show up. only the "hello, " part. This was ...
0
votes
0
answers
91
views
Why does my server says it is a "bad request"?
Everytime I hit the submit button after inserting values, my server gives this message:#
Bad Request
The browser (or proxy) sent a request that this server could not understand.
What does that mean?
...
0
votes
1
answer
268
views
Lecture 9, how to get default value from `flask.request.get` after submitting a form?
In Lecture 9, we learnt about Flask. Prof David taught us in the first couple sections by creating a Python file called app.py, and two similar HTML files that have different code in their bodies, ...
0
votes
1
answer
97
views
Check50 PSET9 Finance Failing Throughout
First post here...seems I'm coming unstuck at the pointy end of the course. Hahaha!
My code doesn't seem to be passing Check50 through Quotes/Buy/Sell - although the functionality seems to be fine ...
0
votes
2
answers
114
views
TypeError: 'NoneType' object is not subscriptable in PSET9, but working manually
I am working on pset9 Finance. I have implemented the functionality for purchasing stocks, and it works well when I manually test it. However, when I run the CS50's check50 validation, it returns an ...
0
votes
1
answer
340
views
CS50 2023 Finance Check50 issue
There is no way to get rid of the following check50 error:
:( logging in as registered user succeeds
application raised an exception (see the log for more details)
I found through googling that in ...
0
votes
1
answer
82
views
Finance app - object is not subscriptable
I have problems with pset 9 finance.
Since days I try to figure out what is wrong with my code for the sell route.
I know that there a handfull of similar questions on StackExchange/StackOverflow but ...
0
votes
0
answers
55
views
In 'Finance' how do I get the page to load?
I have not been able to get any page to load for the Finance problem (even without me messing about with it!). I tried deleting everything and starting again like so:
$ wget https://cdn.cs50.net/2021/...
0
votes
1
answer
90
views
PSET9 FINANCE SQLITE "no such column exists" while multiplying two columns to update a third
In the Index function on APP.PY of my finance code, I'm getting "RuntimeError: no such column: total_per_share" even though I'm using "AS" to create this column -- please advise.
@...
0
votes
2
answers
4k
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
1
answer
202
views
Flask/Python PSET9 Finance -- Using PRINT() to debug
Having some problems with INDEX that I figure printing variable content to console will help me solve. BUT no matter what I try, print(variable) doesn't result in anything at all on the console/...
0
votes
1
answer
287
views
Lab9 -- Buttons to delete DB entries don't work
Can anyone please tell me why my "Remove Entry" from DB buttons don't work?
I included the python.app code below the HTML:
<!DOCTYPE html>
<html lang="en">
...
0
votes
1
answer
66
views
Should I deploy flask app for the final project?
I’m working on a final project, which is a web application using Flask. For it to be graded, should I deploy it on Heroku or only submit my source files. I’m not familiar with Heroku, and from what I ...
0
votes
2
answers
129
views
Is there a way in jinja to display a block in a specific page?
I have a layout.html page with a <footer> that I want to display in almost all pages using {% extends "layout.html %}. Only in the user profile page the footer will be different. How can I ...
0
votes
1
answer
771
views
Flask Filter Search/List in Python
I created a country list on the python search page section, the data is sent to the Html table with jinja syntax “ The Html table also has a JavaScript function it functions correctly no help with ...
0
votes
1
answer
1k
views
jinja code not working inside html file
I am using flask for the first time and jinja code is being displayed on the webpage.
this is my html file:
<!DOCTYPE html>
<html lang="en">
<head>
...
1
vote
1
answer
1k
views
PSET9 / can't check until a frown turns upside down
I am getting this message in the following checks
:| sell page has all required elements/
:| sell handles invalid number of shares
:| sell handles valid sale
I guess the problem is in by sell or buy ...
0
votes
0
answers
129
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
1
answer
2k
views
Check if query returns empty value
I am trying to check using (IF / ELSE) if my query returns any value. What is the simplest way to do this?
Thanks
result = db.execute("SELECT * FROM home WHERE id = ? AND name = ?", str(conn)...
0
votes
1
answer
280
views
Runtime Error Unsupported Value in pset9 Finance
I'm doing Pset09 "Finance" and I have been stuck in the "index" function for quite a while. I tried to use the already existing "trans" table but I am getting an error. ...
0
votes
1
answer
2k
views
Calling a javascript function from flask
For my final project, I am creating a flask web mapping application, which with user input displays different things on a map.
At the moment, when they input a place name via a form, my python ...
1
vote
1
answer
145
views
pset9 // register function not registering user
I am having this problem with my register function in pset9 when i register on the web app it says error 500 internal server error and when i check my terminal it says:
return self.view_functions[rule....
0
votes
0
answers
365
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
2
answers
538
views
CS50 IDE gives error for flask run
I was able to run flask run till yesterday. But today it is not working, it has been giving errors for SQL and I have been able to code today. It gives me this error continuously.
ERROR: Error on ...
0
votes
1
answer
863
views
Generate dynamic datefields from selected dropdown value sent to another route in Flask
EDIT
With the good help of @DinoCoderSaurus, I realised that I overlooked adding a POST method to the datainput form and the routes also lacked GET and POST methods.
Adding those modifications helped ...
0
votes
1
answer
237
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
1
answer
188
views
Blocked on C$50 Finance suggested personal touch feature - adapting index page to enable transactions in situ
Dug into the docs and trawled all the usual online sources but starting to suspect that I'm trying to solve this in a way that's impossible!
This is how I've edited the index page to allow user input ...
0
votes
1
answer
98
views
Final Project: Problem to UPDATE table (Flask and SQLite) - RuntimeError ("unsupported value: {}".format(value))
I'm working on a project tracking web app, in which users can create and categorise their own projects. There are more options, but a project can mainly be categorised as active or paid/finished. Any ...
0
votes
0
answers
765
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
0
answers
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
0
answers
29
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 ...
1
vote
2
answers
3k
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 ...
0
votes
1
answer
549
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
0
answers
21
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
1
answer
117
views
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 ...
2
votes
1
answer
3k
views
Flask Sessions Not Working
I'm using VS Code and following along Brian's Flask class in Web50.
I have copied his notes program word for word, and somehow I get different results. I've downloaded Flask and Sessions, so that's ...
0
votes
0
answers
62
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
1
answer
90
views
Internal Error Served if user doesn't own any shares or sell all his shares in Finance
When i sell all the shares i own or even in the case of a new registered user who doesn't own any shares; it doesn't redirect to "/" i.e the main index page but serves me an internal error. It works ...
0
votes
1
answer
294
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
0
answers
156
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
0
answers
708
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
1
answer
2k
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
0
answers
199
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
1
answer
527
views
Can't access 127.0.0.1 and 0.0.0.0 in CS50 IDE
I am on my final project and i have a simple flask app and and index html template. There are no errors in my app, however when i run flask, flask run, it says Running on http://127.0.0.1:5000/ (Press ...
0
votes
1
answer
620
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
1
answer
45
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</...