This commit is contained in:
Yisroel Baum 2024-09-29 08:14:01 +03:00
parent 298a398c2e
commit 9f90d357fd
6 changed files with 78 additions and 0 deletions

21
app/__init__.py Normal file
View file

@ -0,0 +1,21 @@
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from app.config import Config
db = SQLAlchemy()
migrate = Migrate()
app = Flask(__name__)
app.config.from_object(Config)
db.init_app(app)
migrate.init_app(app,db)
from app import models #.models import Vendor, LineItem, BudgetCategory
from app import routes
if __name__ == '__main__':
app.run(debug=True)

9
app/config.py Normal file
View file

@ -0,0 +1,9 @@
config = {
'SQLALCHEMY_DATABASE_URI_SQLITE': 'sqlite:///site.db',
'SECRET_KEY': '1234567890'
}
class Config():
SQLALCHEMY_DATABASE_URI = config.get('SQLALCHEMY_DATABASE_URI_SQLITE')
SECRET_KEY = config.get('SECRET_KEY')

25
app/models.py Normal file
View file

@ -0,0 +1,25 @@
from app import db
from sqlalchemy import Column, INTEGER, String
class Vendor(db.Model):
__tablename__ = 'vendor'
id = Column('id', INTEGER(), primary_key=True)
name = Column('name', String(), nullable=False)
bc_id = Column('bc_id', INTEGER(), nullable=True)
class BudgetCategory(db.Model):
__tablename__ = 'budget_category'
id = Column('id', INTEGER(), primary_key=True)
name = Column('name', String(), nullable=False)
class LineItem(db.Model):
__tablename__ = 'line_item'
id = Column('id', INTEGER(), primary_key=True)
parent_line_item_id = Column('parent_line_item_id', INTEGER(), nullable=True)
amount = Column('amount', INTEGER(), nullable=False)
currency_type = Column('currency_type', String(), default='shekel')
vendor_id = Column('vendor_id', INTEGER(), nullable=True)
date = Column('date', INTEGER(), nullable=False)
confirmation_code = Column('confirmation_code', INTEGER(), nullable=True)
note = Column('note', String(), nullable=True)

8
app/routes.py Normal file
View file

@ -0,0 +1,8 @@
from app import app
from flask import render_template
@app.route('/')
def home():
return render_template('index.html')

11
app/templates/index.html Normal file
View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Budgeting</title>
</head>
<body>
</body>
</html>