How i can set templates dir for Flask app ?


I have this structure

|__ application
    |__ static
    |__ templates
    |__ modules
Comment actions Permalink
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"
Comment actions Permalink
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:

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

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 = = ''
    return render_template('index.html', form=form, name=name)
Comment actions Permalink

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


Please sign in to leave a comment.