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

56 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1 vote
1 answer
29 views

cs50 web programming, wiki: extend function not working

I'm currently on project 1 wiki in cs50 web. The distribution code already gave me the blocks on layout.html and extend functions on index.html. For some reason, the code I put in the blocks in index....
user avatar
1 vote
0 answers
447 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 ...
user avatar
1 vote
0 answers
214 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 ...
user avatar
1 vote
0 answers
42 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 ...
user avatar
1 vote
0 answers
2k 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\...
user avatar
1 vote
1 answer
454 views

API Goodreads issue with the book page

I have been facing an issue with the API, it does not display in the book page in project1 I keep getting the error "Not Found" could someone help me? Check the screenshots of the python code below, ...
user avatar
0 votes
0 answers
23 views

CS50P project6 shirt.py

question.. on CS50P project 6: shirt.py, I got an error message. I believe my error is on resizing the Moppest image but I don't know what else to do. I did what the instructions said but still having ...
user avatar
0 votes
0 answers
8 views

How to disable a form from views.py .?

How do I achieve the below: @login_required def close_auction(request,listing_id): listing = Listing.objects.get(pk=listing_id) if request.method == "POST": listing....
user avatar
  • 1
0 votes
0 answers
5 views

Tips for entering the world of CS50 Beta?

What windows and what advice do you currently recommend for this 2022?
user avatar
0 votes
1 answer
62 views

Unable to solve "can't check until a frown turns upside down"

I was doing the Cash problem. I entered all the possible output given in the question yet its showing error. Please help, here is my code below . . . . #include <cs50.h> #include <stdio.h> ...
user avatar
  • 1
0 votes
0 answers
14 views

Network - querySelector returning undefined

I'm working on the edit post functionality. Basically I would like to re-render the innerHTML of any given post to display a text, prefilled with the existing contents of the post. The issue I'm ...
user avatar
0 votes
1 answer
71 views

CS50W Project Wiki search function

I am trying to write the search function where the user submits a wiki search. If the query is in the given list of entries, the user should be redirected to related entry's page. If the query doesn't ...
user avatar
0 votes
0 answers
34 views

problem to submit CS50 project0 to github

I create a new branche web50/projects/2020/x/search to my CS50 repository github.com/me50/myname. I didn´t know what happen another project was pushed to this branche and the branche is set as default ...
user avatar
  • 1
0 votes
0 answers
26 views

cs50web project 4 network - "Edit" feature - how to execute two fetch() without the need to create a time delay?

Working on "Edit" feature for project4 network. I wrote a javascript function with two fetch. First one to update the post. Second one to retrieve the now updated post and show it on page (...
user avatar
0 votes
0 answers
27 views

Search: Getting redirect notice for I'm Feeling Lucky

I'm getting a redirect notice when implementing I'm Feeling Lucky, similar to the below: Is there some way to bypass this notice? or is this acceptable for the purposes of this problem set?
user avatar
0 votes
0 answers
37 views

CS50 web network project: like button reloads page and only displays json data instead of the actual webpage

I am working on the cs50 web project network. When the like button is clicked the text in the button should then change to say unlike and the like count should increase by one without reloading the ...
user avatar
0 votes
0 answers
19 views

CS50 Web Wiki Edit Form. Form is returning empty in the edit function

I am having issues with an empty form being provided in the edit function. Everything works well but when I try to edit an entry I get a Value Error saying the HTTPResponse is None and that the ...
user avatar
0 votes
0 answers
23 views

Q: CS50w project3. I keep getting this error: Uncaught (in promise) TypeError: Cannot read properties of null (reading 'appendChild') at new_thing

I am working on CS50 Web project 3 and I keep getting this error Uncaught (in promise) TypeError: Cannot read properties of null (reading 'appendChild') at new_thing here is my function function ...
user avatar
  • 1
0 votes
0 answers
49 views

CS50W-NoReverseMatch Error?

Web Programming Project 1. I can't figure out what is causing this error. Tried searching for an answer everywhere. Error Message Reverse for 'edit' with no arguments not found. 1 pattern(s) tried: [...
user avatar
0 votes
0 answers
342 views

remove 'this field is required' text above django form in wiki

I have a style problem for the wiki project in cs50 web dev. It's one I could ignore and everything would still work, but I have been unable to solve it, and would like to learn what I am missing. I ...
user avatar
0 votes
1 answer
10 views

default relative Imports in Django wiki failing

In views.py, when initially running the pregenerated line from . import util failed with relative import error. The standard from .dir import package also failed. Deleting __init.py__ also has no ...
user avatar
  • 1
0 votes
1 answer
134 views

CS50Web - Not Sending Emails

I just started with the Mail project for CS50Web and came across a really strange problem. Currently, I'm working on the part where I need to send an email. My algorithm for this is simple: Add event ...
user avatar
0 votes
2 answers
628 views

Mail CS50 Web - How to Send Email (API not working)

I'm very new to Javascript and working on mail, project 3 for CS50 web. I've been working on just sending the email initially, for about a week and I'm getting very discouraged. I can't seem to get ...
user avatar
0 votes
1 answer
272 views

cs50w Project 1 Wiki Search: layout.html failing to submit POST to views.py

currently working on the search function for project 1. I've updated layout.html, urls.py, and views.py, but when I input anything into the search bar layout.html does not pass the POST information to ...
user avatar
0 votes
1 answer
446 views

CS50W Django Project1 Wiki - Textarea issue

I got stuck at completing Wiki assignment because of strange behaviour of textarea in form, needed for creating and editing entries. Everytime user saves the entry, for each line of entered text there ...
user avatar
0 votes
1 answer
173 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 ...
user avatar
0 votes
1 answer
144 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 ...
user avatar
0 votes
1 answer
294 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 ...
user avatar
0 votes
1 answer
669 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. ...
user avatar
0 votes
1 answer
126 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/...
user avatar
0 votes
1 answer
145 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 ...
user avatar
  • 5
0 votes
1 answer
182 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 ...
user avatar
  • 1
0 votes
1 answer
574 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): ...
user avatar
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})....
user avatar
  • 1
0 votes
0 answers
132 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 ...
user avatar
0 votes
1 answer
87 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....
user avatar
0 votes
0 answers
48 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 ...
user avatar
0 votes
1 answer
76 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....
user avatar
0 votes
2 answers
288 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 ...
user avatar
0 votes
0 answers
2k 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 ...
user avatar
  • 101
0 votes
0 answers
556 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\...
user avatar
  • 1
0 votes
0 answers
1k 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,...
user avatar
0 votes
1 answer
1k 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["...
user avatar
0 votes
1 answer
69 views

Flash message disappears after redirect

So, during my work on CS50 WEB programming course I came up with this issue. In my Books application (Project 1), when user tries to leave a second review to the same book, the code doesn't let him ...
user avatar
0 votes
0 answers
40 views

can't fetch value from frontend..... "document.querySelector('#text').value;" not working

<html> <head> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script> <script src="http://ajax.googleapis....
user avatar
0 votes
1 answer
117 views

CS50W Project2: communication between SocketIO and JavaScript

I'm trying to get new channel names input by the user to 1) show up on the screen in an unordered list and 2) also show up on other users' screens. I tried to closely follow the template that was used ...
user avatar
  • 63
0 votes
1 answer
26 views

How to simulate different users using only one machine

I am using LocalStorage to save the display name and it does remember the display name after the browser is closed. However to simulate different users on the same machine chatting to each other, I ...
user avatar
0 votes
1 answer
134 views

CS50 Web Programming: Lecture 3 (SQL)- import.py won't work for me

I'm trying to run the same code for import.py from the lecture, but am running into trouble. import.py: import csv import os from sqlalchemy import create_engine from sqlalchemy.orm import ...
user avatar
  • 1
0 votes
1 answer
1k views

Disable caching of css and js file in flask on Safari or Chrome?

Is there any way so that on refresh it loads css , js file automatically in flask . I am using MacOS and using two browser Safari and Chrome . Currently on safari I have to clear cache and refresh the ...
user avatar
0 votes
0 answers
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 ?
user avatar