0

I'm trying to complete a project on the Python 100 Days of Code by Angela Yu, this particular project just wont work and I feel like I've tried every possible combination of package versions. I've gone through every different error message on here and doing the changes just leads to a different error.

Here is my list of code packages, the versions I currently have aren't particularly important as I've been changing them trying to find something that works:

blinker==1.6.2
certifi==2023.5.7
charset-normalizer==3.1.0
click==8.1.3
colorama==0.4.6
dnspython==2.3.0
dominate==2.5.2
email-validator==2.0.0.post2
Flask-Bootstrap==3.3.7.1
Flask-Login==0.6.2
Flask-SQLAlchemy==3.0.2
Flask-WTF==0.14.3
Flask==2.2.2
greenlet==2.0.2
idna==3.4
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.3
pip==23.1.2
requests==2.31.0
setuptools==68.0.0
SQLAlchemy==2.0.17
typing-extensions==4.6.3
urllib3==2.0.3
visitor==0.1.3
Werkzeug==2.0.3
wheel==0.40.0
WTForms==2.3.3

The error message that I get with this particular setup:

TypeError: LocalProxy.__init__() got an unexpected keyword argument 'unbound_message'

This error usually shows up first, then I change the werkzeug and then the error message above happens:

ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security'

The code that I'm trying to run:

from flask import Flask, render_template, redirect, url_for, request
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired
import requests

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///movie-list.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KEY'] = 'secret code'
Bootstrap(app)

db = SQLAlchemy(app)


class Movies(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(250), unique=True, nullable=False)
    year = db.Column(db.Integer, nullable=False)
    description = db.Column(db.String(500), nullable=False)
    rating = db.Column(db.Float, nullable=False)
    ranking = db.Column(db.Integer, unique=True, nullable=False)
    review = db.Column(db.String(500), nullable=False)
    img_url = db.Column(db.String(500), unique=True, nullable=False)

    def __init__(self, title, year, description, rating, ranking, review, img_url):
        self.title = title
        self.year = year
        self.description = description
        self.rating = rating
        self.ranking = ranking
        self.review = review
        self.img_url = img_url


@app.route("/")
def home():
    return render_template("index.html")


if __name__ == '__main__':
    with app.app_context():
        db.create_all()
    app.run(debug=True)

0 Answers0