Python Forum
NameError :name 'name' is not defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NameError :name 'name' is not defined
#1
taking a course at the moment which I why do follow examples, but getting the following Name error: name 'name' not defined.
from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://suz:COCOchanel88@localhost:5432/suzb'


db = SQLAlchemy(app)

class Person(db.Model):
  __tablename__ = 'persons'
  id = db.Column(db.Integer, primary_key=True)
  name = db.Column(db.String(), nullable=False)

db.create_all()

@app.route('/')
def index():
    person = Person.query.first()
    return 'Hello World!' 
when Ieventually run it in my terminal thats when I get the "nameError: name 'name' is not defined"
Reply


Messages In This Thread
NameError :name 'name' is not defined - by Suzzy_ - Dec-24-2019, 02:45 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  NameError: Name 'path' is not defined aniyanetworks 9 59,813 Jun-29-2018, 03:21 PM
Last Post: gontajones
  NameError: name 'download' is not defined ntdropper 3 11,360 Jan-13-2018, 07:18 AM
Last Post: snippsat
  NameError: name 'bsObj' is not defined Blue Dog 14 15,773 Oct-24-2016, 08:34 AM
Last Post: Blue Dog

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020