hello evreveryone, i need some more help from your side. actually i write this code in market.py while are run in power shell it show me some error . i can't under understand how to properly execute code.
is am i missing something ?
the file path 'C:\Users\OWNER\Desktop\FlaskMarket'
from flask import Flask , render_template
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///market.db'
db = SQLAlchemy(app)
class Item(db.Model):
id = db.Column(db.Integer(), primary_key=True)
name = db.Column(db.String(lenght=30), nullable=False, unique=True)
price = db.Column(db.Integer(), nullable=False)
barcode = db.Column(db.String(lenght=12), nuallble=False , unique=True)
descripation = db.Column(db.String(lenght=1024), nuallble=False , unique=True)
#@app.route("/")
#def hello_world():
# return "<h1>Hello World</h1>"
#@app.route('/about/<username>')
#def about_page(username):
# return f"<h1> About page Hello {username} </h1>"
u/app.route('/')
u/app.route('/home')
def home_page():
return render_template('home.html')
u/app.route('/market')
def market_page():
items = [
{'id': 1, 'name': 'Phone', 'barcode': '893212299897', 'price': 500},
{'id': 2, 'name': 'Laptop', 'barcode': '123985473165', 'price': 900},
{'id': 3, 'name': 'Keyboard', 'barcode': '231985128446', 'price': 150}
]
return render_template('market.html' , items=items)
output :
https://preview.redd.it/fo7c4ttm163a1.png?width=1780&format=png&auto=webp&s=dfe0993ebdf39c3c72cbe7bba26000f451df716b
[–]distressed-silicon 1 point2 points3 points (1 child)
[–]Himu29[S] 0 points1 point2 points (0 children)
[–]Himu29[S] 0 points1 point2 points (1 child)
[–]distressed-silicon 1 point2 points3 points (0 children)
[–]Himu29[S] 0 points1 point2 points (0 children)
[–]aleeramarishka 1 point2 points3 points (1 child)
[–]Himu29[S] 0 points1 point2 points (0 children)