Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
onlinebookstore/app.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29 lines (25 sloc)
1.06 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, render_template, redirect, url_for | |
from flask_sqlalchemy import SQLAlchemy | |
from flask_migrate import Migrate, MigrateCommand | |
from flask_script import Manager | |
from flask_uploads import UploadSet, configure_uploads, IMAGES | |
from flask_wtf import FlaskForm | |
from wtforms import StringField ,TextAreaField,IntegerField | |
from flask_wtf.file import FileField,FileAllowed | |
from datetime import date | |
app = Flask(__name__) | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///books.db' | |
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False | |
app.config['DEBUG'] = True | |
app.config['SECRET_KEY'] = 'qhbdhbqedejkwbxdjcewjdjb' | |
db = SQLAlchemy(app) | |
class Books(db.Model): | |
bookname=db.Column(db.Integer) | |
author=db.Column(db.String(50),default="UNKNOWN") | |
publishdate=db.Column(db.date,default="UNKNOWN") | |
ISB13=db.Column(db.Integer,primary_key=True) | |
description=db.Column(db.String(500),) | |
tradeprice=db.Column(db.Integer,nullable=False) | |
retailprice=db.Column(db.Integer,nullable=False) | |
stocks=db.Colomn(db.Integer) | |
image=db.Column(db.String(500)) |