Questions tagged [cs50-web-programming-with-python]

Filter by
Sorted by
Tagged with
0
votes
1answer
24 views

CS50Web: Project1 Wiki - Error loading markdown2 module

I've tried to import the markdown2 module in my views.py file but I get an error ModuleNotFoundError: No module named 'markdown2'. I've tried restarting my machine, uninstalling and reinstalling the ...
0
votes
0answers
13 views

Flask-WTF: input field rendered based on the user's selection

I'm trying to make a form where the user logs an action they've done. Because there were too many actions, they are now split into categories and then, based on which category the user chooses, the ...
0
votes
1answer
40 views

cs50 web programming with python & javascript. Entry not saving and I can't figure out why

I am a newbie coder and I just started the cs50 web programming course on edEX. I seemingly cannot get my code to save a .md (markdown file) in a directory. For now I am just trying to save the .md ...
0
votes
1answer
21 views

Struggling to debug my code as I can't get print statements to work

I've been working on Project 1 from CS50W for a few days now and finally got my search bar to appear on my page! The issue I have now is I don't think the input is being pulled in from my form. I've ...
0
votes
0answers
34 views

Django model default value not working

For some reason, the default value for a Django model field I have doesn't work. As in, if the value is left blank by the user when creating an object for that model, then when the value is used in a ...
0
votes
1answer
76 views

CS50 Web Python Project 1 Wiki: entry method causes search method to break

I'm working on Project 1 Wiki. I've independently got the entry and search functions to work, entry works by itself and search works by itself. If un-comment the code related to entry, search breaks. ...
0
votes
2answers
68 views

CS50W - Mail - Python Timestamp Error?

Per the problem set, I've not changed any of the Python that's included within the problem set for 'Mail'. I've only been tweaking with the JS and the HTML thus far. That's not to say my JS is ...
0
votes
1answer
37 views

PSET8 Finance Buy. SQL query not executing

My buy function is crashing at the SQL query where I'm trying to insert data from the transaction into a transactions table. The types of each column are transaction_id(integer, primary key), user_id(...
0
votes
1answer
49 views

CS50W - Django Forms vs HTML Forms

CS50W 2020 - Project 2 - Commerce How come in lecture 3 (https://cs50.harvard.edu/web/2020/notes/3/#django-forms) Django forms are used, but in lecture 4 (like here: https://cs50.harvard.edu/web/2020/...
0
votes
0answers
49 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
1answer
39 views

CASH NOT UPDATING - FINANCE SELL

so everything I have so far is working except the part where I need to update the cash right after I sell a stock. As you can see in the table below what's happening is that everytime I sell a stock ...
0
votes
0answers
72 views

how do I perform a search

This is project one for wiki and I am stuck this is my last thing to do. below are screenshots of the views.py, util.py and template. We are suppose to use the functions from util.py(This is the last ...
0
votes
0answers
19 views

I keep getting invalid syntax at else. I am trying to redirect a page

here is the code. I keep getting invalid syntax at else. Can someone explain why and help please.
0
votes
0answers
27 views

I keep getting - TypeError: unhashable typ

can't get page to redirect please help. I keep getting the error TypeError: unhashable type: 'dict' at line: return HttpResponseRedirect (reverse("encyclopedia:index", { "entries":...
0
votes
0answers
26 views

how to save an entry and also add it to an existing list

My code won't work need help. for some reason when I try to save an entry it just refreshes me back to the homepage without adding or saving the new entry I tried to create. what can I do different? ...
0
votes
0answers
180 views

CS50 Web 2020, Project 1 - Wiki, CSS not working

I'm currently using Django as explained in cs50w 2020 lecture 3. Under the static folder inside encyclopedia directory is the styles.css. This was in the distro code and there is already some styles ...
0
votes
1answer
80 views

CS50Web python. I can't get a new entry to save and show on the homepage of my wiki project. I am using Django with python

I can't get my code to save a new entry and return an error message if entry already existed. its just the views.py I can't figure out help please. code below
0
votes
2answers
211 views

CS50W - Wiki w/ Django - Search Bar

I cannot for the life of me get the HTML form to transfer the user's search into my search function within views.py. I've tried this a number of different ways and I either just get no movement (as I ...
0
votes
0answers
29 views

Facing issues while trying to Post HTML form contents to views.py route using fetch method POST in javascript

Hello I am trying to post information i get from a form to an API that submits it to the views.py file in Django. Can anyone tell me where i am going wrong. Below is my javascript code ...
0
votes
0answers
47 views

Help please: I keep getting - TypeError: unhashable type: 'dict'

I keep getting - TypeError: unhashable type: 'dict' at line: return HttpResponseRedirect (reverse("encyclopedia:index", { "entries": util.save_entry(title, content) })) My code is ...
1
vote
1answer
208 views

CS50W - Project 0 - “I'm Feeling Lucky”

For the "I'm Feeling Lucky" part, I'm getting a redirect notice (like this: https://images.app.goo.gl/Mgk6knNBYHfe5YKB7). How do I bypass this? Thank you!
0
votes
1answer
217 views

CS50W - Wiki with Django - I want to edit a wiki entry, but I don't know how to send the default value to the template if I use Django forms

I've tried to do this: class editPage(forms.Form): title = forms.CharField() textContent = forms.CharField(widget=forms.Textarea(attrs={'class' : 'textContent'})) def edit(request,name): ...
0
votes
0answers
583 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
47 views

How do I create an advanced query page using HTML and CSS? Should I use any other langauges to make it a faster process?

How do I create an advanced query in HTML and CSS? I have to create a front end similar to Google and have already outfitted the first two pages, it's the 3rd page, the advanced query page that I need ...
0
votes
0answers
41 views

decoding to str: need a bytes-like object, HttpResponse found

While converting markdown to html i am getting this error def title(request, title): global mdValue mdValue = util.get_entry(title) htmlValue = m.convert(mdValue) # error occurs on this ...
1
vote
1answer
62 views

CS50 Web Programming Mail Pset - DOM reloading on every form submission

On the mail pset the inbox page loads as default whenever the DOM is loaded. Whenever I submit my form to send an email the DOM is reloaded and inbox pops up. I'm trying to get the sent mailbox to pop ...
0
votes
0answers
30 views

Placing django_markdown2 somewhere in my PYTHONPATH

I am going over the documentation for using django-markdown2 in Project1, and I don't know what is the best way to: 'Place django_markdown2 somewhere in your PYTHONPATH.' https://github.com/...
0
votes
0answers
7 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
44 views

CS50W Final Project: I need help with deploying my website

for my final project, i made a website that i want to also deploy to production, because i want to be able to implement it in real life. I have made the docker image according to what Brian ...
0
votes
0answers
32 views

HTML: Trying to download files from directory

On the quote.html page I have a download button that I want to download the text.txt file in the files folder but when I press the button it tries to downloads text.htm and outputs an error since ...
0
votes
0answers
23 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
18 views

Flask-socketio not able to send instant messages

I am trying to make a basic chat application with rooms using flask-socketio, but whenever I run the code on my browser, a weird error comes on the console and I am not able to send any messages ...
0
votes
0answers
16 views

href not working properly

i have a layout html file in the following path: C:\Users\user1.vscode\files\web50p1\templates\layout.html in which i have the following code: <a href="/logout">Log Out</a></li&...
1
vote
0answers
31 views

cs50w Project 1: Web page running very slow

I just finished my book review page for project 1 and everything is working fine, but the site takes forever to load certain parts. When trying to log in or create a new account, or when trying to ...
0
votes
1answer
59 views

Can't import books.csv using import.py

I'm on a project1, here is the link to it: https://docs.cs50.net/ocw/web/projects/1/project1.html I've successfully made a Table books using my Python script, however when I try to import the "books....
0
votes
0answers
44 views

Problem with Flask Flashing message - messages appears twice

I'm newbie at Flask. I am trying to manage the flash alerts to appear where I want them. When I write the code get_flashed_messages() in the .html module the messages appears twice, without this code ...
1
vote
1answer
240 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
16 views

Failing to extract data from html selector

I am currently doing the project1 of the CS50 web programming course and having issues extracting data from an html selector into a flask route. I think its probably best if I just describe what I ...
0
votes
0answers
33 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 ...
1
vote
0answers
469 views

sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string

Traceback (most recent call last): File "list.py", line 9, in engine = create_engine(os.getenv("DATABASE_URL")) File "C:\python 3.8\flask_env\env1\venv\lib\site-packages\sqlalchemy\...
0
votes
0answers
21 views

CS50 Web Project 1: Is it necessary to use raw SQL queries?

This is not strictly a coding question, can we use the SQLAlchemy ORM for the Books project? I know it is forbidden to use as per the requirements, but I am unable to run my program using raw ...
0
votes
1answer
57 views

Problem in importing from csv file

I am currently trying to import the contents of the books.csv file into my PostgreSQL database on Adminer. Here's my code: import csv import os from sqlalchemy import create_engine from sqlalchemy....
0
votes
0answers
11 views

Can I use databases to take in signup information from the user?

Can I use database in my Project 1 website for the user signup and login, to store the user information? Or is it necessary to use sessions, as mentioned in the 'hints' section of the Project 1 ...
0
votes
2answers
112 views

adminer.cs50.net giving “Session expired, please login again.” error when attempting to login

This seems to have happened 11 Sept 2019 but it is occurring again. I tried logging into Adminer today and am receiving this error: "Session expired, please login again." I thought my Heroku ...
0
votes
0answers
288 views

NameError: name 'db' is not defined

I've made a simple code using python, where with the help of Flask_sqlalchemy I am trying to create 2 tables in a database which is being hosted by Heroku. The file db.py contains my table details ...
0
votes
0answers
50 views

CS50W Project 2: socket.io is not working for me

I am trying to create the channels real time so they can be broadcasted and i save them in a list on the backend. I will later make sure that all the channels in the list are also put in the list but ...
0
votes
0answers
26 views

CS50W Project 2: Rooms vs Namespaces

I would like to set up separate rooms (or namespaces? which one is better?) for the channels so the messages can only go to the specific channel. I would do this by getting the name of the channel and ...
0
votes
0answers
103 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
20 views

Project0 bot marks

I am doing a course called Web Development with Python and JavaScript, i did my project0 and submitted it. After a few days i got an email from c50 bot as shown in the image, i cant understand it ...
0
votes
0answers
272 views

ValueError: not enough values to unpack (expected 2, got 0)

I'm having this value error when I run my menu function. Please help me solve this error. Thank you. python code : def index(request): if not request.user.is_authenticated: return render(request,...