PyCharm 2017.1 ~ Bootstrap CSS in Flask Jinja code completion not working

I have a problem with PyCharm code completion. I am using PyCharm to develop a Flask application with Jinja as template engine. I also use the Bootstrap CSS library for UI (version 4). The code completion does not offer any suggestions on some settings. My PyCharm installation information is as follows:

PyCharm 2017.1
Build #PY-171.3780.115, built on March 24, 2017

JRE: 1.8.0_112-release-736-b13 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.3


In my HTML template, I usually use the following code for inserting CSS:

<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename="css/bootstrap.css")

The above code works well when I execute the Flask application, but no code suggestion or completion for the Bootstrap classes in the IDE. If I change the CSS call to the following:

<link rel="stylesheet" type="text/css" href="/static/css/bootstrap.css">

The code executes well and the IDE also offer code suggestions in the HTML editor.

Is this a normal behavior? or is there a setting that I can change so that I can use the Flask way of generating URLs instead of hard-coding the URLs in the code?

Please sign in to leave a comment.