15 lines
449 B
Python
15 lines
449 B
Python
|
|
import os
|
||
|
|
os.environ.setdefault('FLASK_CONFIG', 'development')
|
||
|
|
|
||
|
|
from app import create_app, db
|
||
|
|
from app.models import Product
|
||
|
|
|
||
|
|
app = create_app()
|
||
|
|
|
||
|
|
with app.app_context():
|
||
|
|
products = Product.query.all()
|
||
|
|
print('Total products:', len(products))
|
||
|
|
print('Product names:', [p.product_name for p in products])
|
||
|
|
print('Product details:')
|
||
|
|
for p in products:
|
||
|
|
print(f' ID: {p.product_id}, Name: {p.product_name}, Status: {p.status}')
|