Compare commits

..

3 Commits

Author SHA1 Message Date
08d14b61d1 removed src folder, refactored 2024-02-28 15:27:44 -05:00
5bba8e6947 view dir removed, skill template in root app 2024-02-28 15:20:22 -05:00
3a15a29d9b serve_media refactor 2024-02-28 15:15:08 -05:00
13 changed files with 20 additions and 30 deletions

View File

@ -1,5 +1,5 @@
from flask import jsonify, Blueprint from flask import jsonify, Blueprint
from ..util.utils import breeding_pair_data from utils.utils import breeding_pair_data
get_breeding_pairs_bp = Blueprint('breeding_pairs',__name__) get_breeding_pairs_bp = Blueprint('breeding_pairs',__name__)

View File

@ -1,5 +1,5 @@
from flask import jsonify, Blueprint from flask import jsonify, Blueprint
from ..util.utils import breeding_pair_data from utils.utils import breeding_pair_data
get_breeding_usage_bp = Blueprint('breeding_usage',__name__) get_breeding_usage_bp = Blueprint('breeding_usage',__name__)

28
app.py
View File

@ -1,17 +1,14 @@
from flask import Flask, render_template from flask import Flask, render_template
from src.util.utils import * from api.get_monsters import *
from api.get_families import *
from api.get_monster_stats import *
from api.get_breeding_pairs import *
from api.get_breeding_usage import *
from api.get_skills_data import *
from src.api.get_monsters import * from utils.utils import *
from src.api.get_families import * from utils.serve_media import *
from src.api.get_monster_stats import *
from src.api.get_breeding_pairs import *
from src.api.get_breeding_usage import *
from src.api.get_skills_data import *
from src.views.serve_content import *
from src.views.skills import *
app = Flask(__name__) app = Flask(__name__)
@ -28,15 +25,20 @@ app.register_blueprint(get_breeding_usage_bp)
app.register_blueprint(get_skills_data_bp) app.register_blueprint(get_skills_data_bp)
# Register Serve Content Blueprints # Register Serve Content Blueprints
app.register_blueprint(serve_content) app.register_blueprint(serve_media)
# Register Other Views Blurprints (HTML Render Templates) # Register Other Views Blurprints (HTML Render Templates)
app.register_blueprint(skills_bp) #app.register_blueprint(skills_bp)
@app.route("/") @app.route("/")
def show_app(): def show_app():
js_files = get_js_files() js_files = get_js_files()
return render_template("app.html", js_files=js_files) return render_template("app.html", js_files=js_files)
@app.route('/skills')
def skills():
csv_data = read_csv('static/data/skills_data.csv')
return render_template('skills.html', csv_data=csv_data)
if __name__ == "__main__": if __name__ == "__main__":
app.run(debug=True) app.run(debug=True)

View File

View File

@ -1,12 +0,0 @@
from flask import Blueprint, render_template
from ..util.utils import *
skills_bp = Blueprint('skills', __name__)
serve_monster_sprite_bp = Blueprint('monster_sprite', __name__)
#Serve Monster Sprites
@skills_bp.route('/skills')
def skills():
csv_data = read_csv('static/data/skills_data.csv')
return render_template('skills.html', csv_data=csv_data)

View File

@ -1,13 +1,13 @@
from flask import send_from_directory, Blueprint from flask import send_from_directory, Blueprint
serve_content = Blueprint('favicon', __name__) serve_media = Blueprint('favicon', __name__)
#Serve Monster Sprites #Serve Monster Sprites
@serve_content.route('/img/monster/<selected_monster>.png') @serve_media.route('/img/monster/<selected_monster>.png')
def serve_monster_sprite(selected_monster): def serve_monster_sprite(selected_monster):
return send_from_directory('static/img/monster/', f'{selected_monster}.png') return send_from_directory('static/img/monster/', f'{selected_monster}.png')
#Serve Favicon #Serve Favicon
@serve_content.route('/img/favicon.ico') @serve_media.route('/img/favicon.ico')
def serve_favicon(): def serve_favicon():
return send_from_directory( '','static/img/favicon.ico') return send_from_directory( '','static/img/favicon.ico')