I'm trying to using Flask Blueprint to make routes from another file. This is my "catalog.py file:
from flask import Blueprint, make_response, render_template
from models.catalog import Catalog
catalog_url = Blueprint('catalog_url', __name__)
@catalog_url.route("/")
@catalog_url.route("/catalog")
def show_all_catalogs():
try:
catalogs = Catalog.find_all_catalogs()
return render_template('publiccatalogs.html', catalogs=catalogs)
except:
return {'message': 'Internal Server Error'}, 500
This is my "app.py" file:
from catalog import catalog_url
app = Flask(__name__)
app.register_blueprint(catalog_url)
But when I enter "localhost:5000/catalog", it returns this error:
TypeError: 'dict' object is not callable
I tried returning plain text and even JSON, they worked just fine. But when I try to use "render_template", I keep getting the same error.