Questions tagged [flask]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
12 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
1answer
18 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
0answers
48 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
1answer
34 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
1answer
248 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 ...
0
votes
1answer
29 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
0answers
82 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
2answers
104 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
0answers
43 views

Configure app not to use the filesystem

For the final project I have made an app and deployed it on heroku. From other questions I realized that heroku can't store changes for a long time, so I kept getting logged out as soon as I was ...
0
votes
0answers
182 views

jinja2.exceptions.UndefinedError

Hi all I am trying to get an app to work and i keep on getting an error jinja2.exceptions.UndefinedError jinja2.exceptions.UndefinedError: 'data' is undefined here is my code it would be great is ...
0
votes
1answer
149 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
0answers
15 views

url_for not giving correct url

I am making a quiz app for the final project. i cannot give the parameters required through url_for. here is are the functions. functions: @app.route('/quiz') @login_required def quiz(): if ...
0
votes
0answers
103 views

Running web applications (Django and/or Flask) on CS50 IDE

Hope you all are doing great. Had a quick question about the CS50 IDE and running web applications on it. One thing I noticed when running my web applications on CS50 IDE either by using "python ...
0
votes
1answer
32 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
1answer
66 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
1answer
31 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
0answers
44 views

CS50 Web Track - Finance: OSError: [Errno 99] Cannot assign requested address

I'm trying to create a standard 'forgot password' feature for my web application. The issue is, when the user types in their email address and clicks submit to receive a token after which they can ...
0
votes
0answers
22 views

JavaScript functionalities not applied when JavaScript code written in an external .js file for a flask application

I'm working on project2 of CS50's web programming using python and javascript. I've made a .htm file and I need to write some javascript code for the page. I first wrote the code in an external file ...
0
votes
0answers
100 views

Final Project: Error on uploading files to CS50 IDE via form

tl;dr: CS50 IDE won't let me upload certain kinds of files (via a form on a webpage) without any explanation. I'm writing the function upload_file() that allows the user to upload a file. (It's a CSV ...
0
votes
0answers
138 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
28 views

I am working on project 1 and created .pylintrc file but db: scoped_session Instance of 'scoped_session' has no 'execute' memberpylint(no-member)

I am working on project 1 and I have also created the .pylintrc file and write ignored-classes=SQLObject,Registrant,scoped_session but still get db: scoped_session Instance of 'scoped_session' has no '...
0
votes
0answers
18 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
0answers
11 views

CS50w flack (chat) project: channel user list stops updating after a while, can't understand why

This is a weird one, so I've recorded a short video to better illustrate the problem. As an additional feature to my chat app I have a panel on the right that displays the users currently on the ...
0
votes
0answers
26 views

Internal Server Error

Error Message: "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.&...
1
vote
2answers
619 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
0answers
8 views

Does __tablename__ create a new table for each object? And what is .query.all? Is it a method?

I am really confused In CS50'S Web Programming with Python and Javascript-ORMs and APIs. There is weird syntax like class.query.all. What is Its definition (a method, a function, etc).
0
votes
0answers
22 views

Flask file uploading, processing and sending back

wondering if anyone can please share some useful resources for uploading, processing and downloading files within a Flask application. I have spent a lot of time looking for resources online, but the ...
0
votes
0answers
61 views

CS50 Web Flask-Login Issue: User Authentication Issue

I have a login page that uses a custom FlaskForm (using WTForms). If a user enters the correct credentials, a PostgreSQL database is successfully queried (using flask-sqlalchemy) to see if a user with ...
0
votes
1answer
102 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
25 views

Session issue on CS50s project 1 Book Review

I need to learn more about session. I have book route which goes to a book page stating the description of the book, reviews from other users and write a review. I create a form in html and submit my ...
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
25 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 ...
1
vote
1answer
742 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
0answers
42 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
54 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
1answer
96 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
22 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
1k 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
307 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
541 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
66 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
267 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
1answer
71 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
26 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
1answer
224 views

flask register, issue with importing cs50 module

Im trying to run a flask app locally with also using the cs50 module but i keep getting an error: NoAppException: While importing "application", an ImportError was raised: Traceback (most recent ...
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
2answers
811 views

How do I turn debug mode ON in flask?

I have tried export FLASK_ENV=development then adding app.config['DEBUG'] = True to my program but i keep getting * Serving Flask app "test.py" (lazy loading) * Environment: development * ...
0
votes
1answer
37 views

Getting a phishing warning when running flask on cs50 IDE

Everything was working fine, but suddenly my browsers and anti-virus spit out warnings when I want to run flask on the cs50 IDE. I don't want to disable my antivirus every time I'm working on my ...
0
votes
1answer
104 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 ...