Initial checkin

This commit is contained in:
2023-05-18 18:21:00 -04:00
commit 1c64f16aef
21 changed files with 1020 additions and 0 deletions

37
app/__init__.py Normal file
View File

@@ -0,0 +1,37 @@
from flask import Flask
from test.vehicle_data import vehicle_data
from .extensions import db, ma
from .models.vehicle import Vehicle
def create_app():
app = Flask(__name__)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3'
db.init_app(app)
ma.init_app(app)
@app.cli.command("reset-db")
def reset_db():
db.drop_all()
db.create_all()
@app.cli.command("create-vehicles")
def create_vehicles():
for vehicle in vehicle_data:
db.session.add(Vehicle(**vehicle))
db.session.commit()
from .routes.vehicle import vehicle_routes
app.register_blueprint(vehicle_routes)
from .routes.shift import shift_routes
app.register_blueprint(shift_routes)
from .routes.auto import auto_routes
app.register_blueprint(auto_routes)
return app