Effective PyCharm Transcripts
Chapter: Server-side Python web apps
Lecture: Selecting the template language

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Remember that Flask could have Jinja or Mako and there's other frameworks like pyramid that
0:07 have Chameleon or even some extensions that I have written for, say FastAPI that allows you to use both Jinja and Chameleon with Flask API Those
0:17 are open source. If you care about them, just check them out of my GitHub repo If I've got this dot HTML file,
0:23 remember straight away when I type something. It it started doing all the cool stuff than it does for Jinja. How does it know? How is it?
0:31 There's nothing about the extension here. It's not like J2 or some odd things like that.
0:35 It's just HTML. How does it know which one of these we're going to use if you created with Flask and you choose the option,
0:41 it sets that for the project but if you open an existing one, it might not know if you want to change it,
0:48 how would it know? So let's go and open up the preferences real quick and you come over here and type template languages to search for it.
0:55 Or you just go down to language. Framework, template language and you can go down and add different file types and indicate
1:02 which ones those are being involved with for your templates and then here's what you do
1:06 Usually sometimes you'll find this set to be none and you'll get no auto complete
1:11 So if you get no auto complete in your HTML for the template side features be a Chameleon or Jinja or whatever.
1:18 Go check this and and realize that you might have to set it. So we go over here and click Jinja
1:25 it will now know, but if I go over here and click Chameleon notice it will be getting different stuff. So if I do that book no more help.
1:33 But if I had a div and chameleon we have this thing called the template attribute
1:37 language. So I'd say tal notice there's all the chameleon auto complete. Why? Because I told PyCharm my HTML files are chameleon,
1:46 they're not Jinja because this is Flask but it's really important that if this is not set you will get a much lower end experience.
1:54 Also note that this is a feature, one of the first features were encountering that is a PyCharm professional feature when you
2:03 use the community one does a lot of cool things but it doesn't do the server
2:06 side web frameworks, you can create and run flask and other apps but you don't
2:11 get that integration, stay with the auto complete here and the navigation back and forth
2:17 like this and so on. So just make sure that if you're working with uh
2:23 template files and you haven't set that or some reason you didn't go through a path that automatically selected it like a new Flask.
2:29 Project, choosing the template language that you go over, do language frameworks, templates and you set it to what you want it to be


Talk Python's Mastodon Michael Kennedy's Mastodon