diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c8fb93a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +**/__pycache__/ +instance/ +migrations/ +static/ \ No newline at end of file diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..02712ce --- /dev/null +++ b/app/__init__.py @@ -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) diff --git a/app/config.py b/app/config.py new file mode 100644 index 0000000..26245af --- /dev/null +++ b/app/config.py @@ -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') \ No newline at end of file diff --git a/app/models.py b/app/models.py new file mode 100644 index 0000000..fc75980 --- /dev/null +++ b/app/models.py @@ -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) + diff --git a/app/routes.py b/app/routes.py new file mode 100644 index 0000000..e28f7c7 --- /dev/null +++ b/app/routes.py @@ -0,0 +1,8 @@ +from app import app +from flask import render_template + + + +@app.route('/') +def home(): + return render_template('index.html') \ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html new file mode 100644 index 0000000..cda7f5d --- /dev/null +++ b/app/templates/index.html @@ -0,0 +1,11 @@ + + +
+ + +