Python Website Full Tutorial - Flask, Authentication, Databases & More
Why Stack Overflow recommends it
Stack Overflow users link it as the tutorial they were following when they hit Flask, Jinja, SQLAlchemy or flask_login errors, so it serves as the context for their debugging questions.
Recommended by 1 people across 1 different months, 2021 to 2023.
What it is
A 2h16m Tech With Tim tutorial that builds a complete Flask web app in Python, covering routes, Jinja templates, forms, message flashing, Flask-SQLAlchemy models, user sign-up, login and logout. It is a follow-along coding session that ends in a finished project with user accounts and notes stored in a database.
What people said
Recommends bro · 2022-04 · Stack Overflow · on “Is it possible to 'refresh' your website with newly added data to a json file?”
yes it does. please mark my answer as the answer i need that stack overflow repity reputation. also heres a video you can reference if my answer didnt explain things well enough [this video]
Cites Nicholas · 2021-05 · Stack Overflow · on “Using Jinja to loop through a DB table getting error: 'DB name' is undefined”
Been working on creating a web app using flask. Was following this tutorial: [this video] My app is a banking app unlike in the video. At this point in my project I am past the video and am trying to create a page where users can view bank accounts that were created by them after they have been stored in the DB. Using Jinja I tried a for loop to get the accounts associated to a specific user. In the video the guys uses a very similar for loop {% block content %} <div class="container py-3 p-3 my-3 border"> <h3 style="text-align:Center">Your Accounts</h3> <form name="banks"> {% for bank in account.bank_accounts %} <label for="banks">Choose an Account</label> <select id="banks" name="banks"> <optio
Cites Vidyuth · 2021-06 · Stack Overflow · on “attribute error in Flask when I run (AttributeError: 'NoneType' object has no attribute 'run' )”
I'm Doing the tutorial ( [this video] ) it was working nicely since there was a problem I don't what.When I run the main.py Traceback (most recent call last): File "c:\Users\admin\Documents\Flask\main.py", line 6, in <module> app.run(debug=True) AttributeError: 'NoneType' object has no attribute 'run' PS C:\Users\admin\Documents\Flask> And the website isn't comming This site can’t be reached 127.0.0.1 refused to connect. It will really helpful if u find out why I'm struglling with it Flask/main.py from website import create_app app = create_app() if __name__ == '__main__': app.run(debug=True) website/ init .py from flask import Flask def create_app(): app = Flask(__name__) app.config['SECRET_KEY'
Cites Jeffee102 · 2021-06 · Stack Overflow · on “Flasksqlalchemy 'BaseQuery' object has no attribute”
I'm following this tutorial from tech with tim [this video] about flask so I could understand some of the basics of flask, everything was going ok until I tried to log in a user and it gave a Nonetype error, I don't know what I did but then changing variable names it gave me a BaseQuery has no attribute 'password' , I've been changing everything I could think about from the db model file and the auth file and also the login html file but it didn't work, this are the files I think are the problem: from auth.py: from flask import Blueprint, render_template, request, flash, redirect, url_for from . import db from .models import User from werkzeug.security import generate_password_hash, check_passwor
Cites Jeffee102 · 2021-06 · Stack Overflow · on “login_user() Nonetype object has no attribute is_active with flask_login”
I'm following this tutorial [this video] , when I tried to remember the user logged in after signing up, it doesn't work and shows 'NoneType' object has no attribute 'is_active' error, although, it did registered the user, so I don't know what's happening, it was working before so I know the problem is not in the function itself. Here's the code: def signup(): if request.method == "POST": # getting information into backend email = request.form.get('email') user_name = request.form.get('userName') password_first = request.form.get('passwordFirst') password_confirm = request.form.get('passwordConfirm') # Checking if everything's ok user = User.query.filter_by(email=email).first() if user: flash("Th
Cites Zzz Zzz · 2021-10 · Stack Overflow · on “When I inherit sqlalchemy (flask app) in a class, it doesn't recognize functions such as Column()”
I've been building a Flask app with the help of this video: [this video] Here is the file of my init so far : from flask import Flask from flask_sqlalchemy import SQLAlchemy from os import path DB_NAME = "database.db" db = SQLAlchemy() app = Flask(__name__) app.config['SECRET_KEY'] = 'bindthemostselling' app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_NAME}' db.init_app(app) from views import views from auth import auth app.register_blueprint(views, url_prefix='/') app.register_blueprint(auth, url_prefix='/') if __name__ == '__main__': app.run(debug=True) and here is the file of my models so far its just one class: from flask_login import UserMixin from . import db class User(db.Model, Us
Cites Enio · 2022-01 · Stack Overflow · on “My website is not working after i deleted and replaced it a part of the database in flask-sqlalchemy (sqlalchemy.exc.DatabaseError)”
So I was following this tutorial on youtube [this video] so the whole code is there and everything was working out perfectly until I accidentally deleted part of the database from the file database.db SQLite format3 � _ �_ �YtablenotenoteCREATE TABLE note ( id INTEGER NOT NULL, data VARCHAR(10000), date DATETIME, user_id INTEGER, PRIMARY KEY (id), FOREIGN KEY(user_id) REFERENCES user (id) )�/�AtableuseruserCREATE TABLE user ( id INTEGER NOT NULL, email VARCHAR(150), password VARCHAR(150), first_name VARCHAR(150), PRIMARY KEY (id), UNIQUE (email) )'; indexsqlite_autoindex_user_1user So the code above is the original database.db code and I deleted the code below and immediately replaced it id INTEG
Cites Unicorn CTHC · 2022-11 · Stack Overflow · on “127.0.0.1 Refused To Connect (Coded in Codecademy)”
I am quite a beginner in coding, trying to complete a programming assignment focused on Python. I followed along with Tech with Tim's YouTube video about "Python Website Full Tutorial - Flask, Authentication, Databases & More". Link: [this video] I have followed the code exactly up until 13:36, where he accesses the website url ( [LINK] ). I have tried this, yet I got a 127.0.0.1 refused to connect error. [LINK] I have tried to follow many different tutorials on how to fix this error, but to no avail. I tried: flushing the dns disabling the firewall (real pain) browser HSTS settings I would have tried asking my teacher, but she already got lost when I tried to explain about front-end and back-end
Cites Kira Yoshikage · 2023-03 · Stack Overflow · on “Building a website using python for the first time and getting an import error, does anyone know why?”
I'm using this tutorial to build my first website and my directory setup is identical as shown in the video: [this video] main.py : from website import create_app app = create_app() if __name__ == '__main__': app.run(debug=True) __init__.py : from flask import Flask def create_app(): app = Flask(__name__) app.config['SECRET_KEY'] = 'kjfhksdjfh kjhdfkjsh return app After running this error is returned ImportError: cannot import name 'create_app' from 'website' I have tried running the code again, changing the import/function order. When doing so, I get an error stating create_app is not defined.
Cites xiaoqi · 2023-07 · Stack Overflow · on “{% block content %} {% endblock %} displayed as text”
I'm going through an online tutorial [this video] on python web development. However, despite double check all the codes are the same, I can't get visual studio to recognize the {% block content %} {% endblock %} as a part of the code. The expected output should be only the contents between {% block content %} {% endblock %} , however, '{% block content %} {% endblock %}' is displayed as plain text on the web page, which is not expected behavior. And the rest of the codes on other templates did not work as well. <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> ... <title> {% block title %}Home{% endblock %} </title> </he