How i can set templates dir for Flask app ?

Hello

I have this structure

Project
|__ application
    |__ static
    |__ templates
    |__ modules
        |
3 comments
Hi kise97,

you should select template language in Settings->"Python Template Languages" and then right click on the folder and choose "Mark directory as template"
0
Same problem here... working with a project set up as a Flask application and checked out from git.  

I've marked the templates directory as such and checked that html/jinja2 is selected as template language in settings.

Still getting warnings that the template files cannot be found in these blocks of code:

@app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html'), 404


@app.errorhandler(500)
def internal_server_error(e):
    return render_template('500.html'), 500


@app.route('/', methods=['GET', 'POST'])
def index():
    name = None
    form = NameForm()
    if form.validate_on_submit():
        name = form.name.data
        form.name.data = ''
    return render_template('index.html', form=form, name=name)
prettyPrint();
0

@Monte - Have you turned it off and on again? Respectively, have you closed IntelliJ and opened it again? This did the trick for me.

0

Please sign in to leave a comment.