40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from flask import Flask, redirect
|
|
from sqlalchemy import exc
|
|
from models import *
|
|
|
|
# Import the Blueprints
|
|
from routes.viewall import viewall_bp
|
|
from routes.export_csv import export_csv_bp
|
|
from routes.viewasset import viewasset_bp
|
|
from routes.create import addasset_bp
|
|
from routes.update import update_bp
|
|
from routes.delete import delete_bp
|
|
from routes.upload import upload_bp
|
|
from routes.confirm_save import confirm_save_bp
|
|
|
|
app = Flask(__name__)
|
|
app.secret_key = 'your_secret_key' # Required for flashing messages and session
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://assetadmin:1234@localhost/asset_test_db'
|
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|
db.init_app(app)
|
|
|
|
# Register the Blueprints
|
|
app.register_blueprint(viewall_bp)
|
|
app.register_blueprint(export_csv_bp)
|
|
app.register_blueprint(viewasset_bp)
|
|
app.register_blueprint(addasset_bp)
|
|
app.register_blueprint(update_bp)
|
|
app.register_blueprint(delete_bp)
|
|
app.register_blueprint(upload_bp)
|
|
app.register_blueprint(confirm_save_bp)
|
|
|
|
with app.app_context():
|
|
db.create_all()
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return redirect('/viewall')
|
|
|
|
if __name__ == '__main__':
|
|
app.run(host='localhost', port=5000)
|