#app.py
from flask import Flask, render_template, request, redirect, url_for, flash
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
app = Flask(__name__)
app.config[‘SQLALCHEMY_DATABASE_URI’] = ‘sqlite:///logininfo.db’
app.config[‘SQLALCHEMY_TRACK_MODIFICATIONS’] = False
app.config[‘SECRET_KEY’] = ‘your_secret_key’
db = SQLAlchemy(app)
# Create tables in the database
# logininfo tab
class User(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
username = db.Column(db.String(80), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
password_hash = db.Column(db.String(128), nullable=False)
class SkillTreeType(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255), nullable=False)
description = db.Column(db.Text)
class SkillTree(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255), nullable=False)
description = db.Column(db.Text)
skill_tree_type_id = db.Column(db.Integer, db.ForeignKey(‘skill_tree_type.id’), nullable=False)
# Define the relationship between SkillTreeType and SkillTree
skill_tree_type = db.relationship(‘SkillTreeType’, backref=’skill_trees’)
# Define the relationship between SkillTree and Skill
skills = db.relationship(‘Skill’, backref=’associated_skill_tree’, lazy=’dynamic’)
class Skill(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255), nullable=False)
description = db.Column(db.Text)
points = db.Column(db.Integer, default=0)
video_link = db.Column(db.String(255)) # Add this line for video links
skill_tree_id = db.Column(db.Integer, db.ForeignKey(‘skill_tree.id’), nullable=False)
# Define the relationship between Skill and SkillTree
skill_tree_relation = db.relationship(‘SkillTree’, backref=’skills’, lazy=’dynamic’)
with app.app_context():
db.create_all()
I’m creating a webpage which involves accounts. when i run this and log in, an argument error shows up. i don’t know whats wrong with it.