dpgaspar / Flask-AppBuilder

Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more. Demo (login with guest/welcome) - http://flaskappbuilder.pythonanywhere.com/
BSD 3-Clause "New" or "Revised" License
4.67k stars 1.36k forks source link

fab_addons cannot use their own templates-directory? #730

Open woutervh opened 6 years ago

woutervh commented 6 years ago

Using Flask-AppBuilder 1.10.0 / Python3.5: When you create a fab_addon, the templates-directory does not get registered in the flask-app.

Suppose you have an addon like this;

fab_addon_upload/ views.py forms.py templates/succes.html

and following view:

    class UploadView(SimpleFormView):
        form = UploadForm
        form_title = 'Upload'
        template_folder = 'templates'

        def form_get(self, form):
            pass

        def form_post(self, form):
            """post process form"""
            return self.render_template('success.html')   # NOT FOUND
            return self.render_template('uploadview/success.html')  # NOT FOUND

Anyone found a way to get this working?

cw1427 commented 6 years ago

Hi: Please see my PR: https://github.com/dpgaspar/Flask-AppBuilder/pull/716 also you can refer my addon: fab-addon-autodoc 0.1.4 on pypi just added template_folder and static_folder on the view and it can work.