Other Useful Features
00:00 Welcome to this part where we’ll talk a little bit about other useful features in PyCharm. I’ve already gone over quite a bit of them in this Overview and Use Cases video at the beginning. Here, I just want to pick out three of those because there’s a lot going on and there’s a lot I didn’t even talk about—you can dive really deep with PyCharm—but I just want to give you a quick overview, so I picked out three features that I found are extremely helpful, that PyCharm does very well, and I’ll talk about those a little bit more.
00:29 The first one is the project-level understanding.
00:34 When I head back over to this portfolio project, the Django app that we looked at before at the beginning, I told you that one of the most important things to know—and also PyCharm thinks like that because they offer it to you here right at the beginning—is saying Search Everywhere, Shift + Shift.
00:49 So if I press this Shift + Shift, it gives me just this opportunity to search across every file and every declaration—everything that is part of this project that I’m working on over here, that I can see over there.
01:03
And that’s such a powerful feature because you can move to files—yeah, we looked for urls.py
before, let’s do that again. Same typo, ha. Okay, here we are. And it just jumps right in there.
01:17 I can go to a declaration…
01:22 that is inside of a file, you see? And it takes me right there. So if you have some kind of a mental map of what’s going on in your project, you can switch very quickly between those different places by just starting off with this double-tap Shift, and then move forward.
01:37
You can see up here that it also allows you to search for only specific things, so I could say Symbols, in that case, because I’m just looking for the declaration of DATABASES
and that’s going to make it even quicker for me to find, I don’t have to go down. Or you can look only for Files. In this case, we don’t have a databases
file, but if I switched it to your “urls”. You see, I can only see the files that exist that contain this search term. Or what we also did before, we can search for Actions. That would be, for example, preferences, so the themes—we can look for “themes”.
02:12 And then there you go. It’s much easier to see because it’s only displaying the different actions that you can do, right? And all of those have their own shortcuts.
02:21 One that PyCharm tells us at the beginning is Go to File.
02:28
Command + Shift + O opens up this Search Everywhere window, but it’s already selected for Files, so now we know we’re just looking for the file settings.py
instead of all sorts of settings files. Okay.
02:42 All right, and here I am.
02:46
One thing that we could see just now without me searching for “databases”, when I reopen this file, all right, so let’s do this again. Command + Shift + O and I reopen the settings.py
file. It takes me right back to DATABASES
.
02:59
That’s because PyCharm remembers where I was the last time when I had this file open, so if I’m up here, right? INSTALLED_APPS
, maybe I did something there, I closed this file, and then I want to go back there—
03:12 it brings me right back to where I was. So that’s another cool feature about it. And it’s simply because PyCharm keeps a track of everything that you do inside of your IDE, and it has this project-level understanding that I mentioned beforehand that just allows us to search everywhere and allows you to switch around.
03:29 It gives you features and possibilities that some text editors that are approaching this on a more basic, more on a per-file level—they just can’t give you this kind of power.
03:40 All right! And also having the environment included is part of this whole thing, ha.
03:46 So that’s what I wanted to say about project-level understanding—your tool to access the powers that are related to a project-level understanding is the Shift + Shift, Search Everywhere, and its more specific ones—search specific symbols, inside of your files, or specific files inside of your project. And get started with getting familiar and used to always typing double Shift, and then just type in what you’re looking for.
04:11 PyCharm’s probably going to find what you want, something,
04:17 and then scroll through those results and find what you’re looking for and move there. Okay. So far to this number one, project-level understanding.
04:27
The next one I want to talk about is that PyCharm is multilingual, so it knows lots of different code highlighting syntaxes just out of the box, and it knows how to put them together into this one big way of dealing with them. What we looked at before, we looked at some template files. Let’s go to base.html
and you can see in here that the HTML is correctly recognized.
04:52 It’s easy to read. We can see how the classes are in here in green, we have our HTML elements in orange right here, and then the attributes are in white. So it’s easy to see, even though it’s HTML and we’re in PyCharm, an IDE that talks about Python, but it also understands HTML.
05:11 Plus it also understands Django templating syntax in here, which is also nicely highlighted. This makes interacting just much easier. One thing you can also do in here, PyCharm offers you, “This is an HTML file, do you want to open it up in the browser?” So you can just click on the browser symbol that you have, and it opens up the file for you. And now, this is not a great example because it’s a dynamically generated file, so this doesn’t actually give us what we’re expecting, because we need to have the server running.
05:40 But if you would be writing an HTML file, you can just click right here on your browser symbol and it opens it up for you in the browser right away. Another thing that is very useful is Markdown files.
05:52
You can write in Markdown—such a quick and easy way to write any documentation—and PyCharm displays it live here. Display it live for me!
And like most of the formatting that you can get with Markdown, you can also simply display here. So if I make this a heading, in the preview I see that it’s a level-one heading right away. All right!
06:19 So that’s just another example. We have HTML as an example, we have Markdown as an example, also JavaScript works like that—it has the correct highlighting and you have autocompletes and everything just included. And that’s what it means for me, that PyCharm is multi-code/lingual.
06:37 Another thing that’s a great help for these big web projects where you have to handle all these different technologies—like, there’s some JavaScript, there’s some Python, there’s some HTML, and there’s usually also a database involved. And PyCharm has great database support, so let’s take another look at this in our example.
06:57 Here, I just have a standard Django app, so I’m using a SQLite file right here for a database. But this would also work if you’re working with Postgres or any other database server. In this case, I just double-click it to access the database settings here.
07:15 And right away, PyCharm understands the structure of the database file that it’s working with here. It gives me all the different tables that Django defines by default.
07:23 It also gives me the tables that I defined myself. For example, here, the projects table. And I showed this quickly before—let’s do it again. You can make a diagram and see how your database is structured.
07:38 Let’s actually look at a big one. How it’s all related with each other—
07:54
Zoom in, move around, and you can get a good understanding of how does your database work internally. We see what is related to what. Now, this looks somewhat complicated, because there’s all these Django default generated things in there. But let’s look at this part, for example. Here we’re working with a blog, and we see here we have a blog id
and it relates to a post, and it relates to a category. Those are separate tables. And it just gives you this—if you’re familiar with working with databases, this is a very common view of understanding them. How are they related?
08:27 It can just give you this right away, in a visual way of looking at it. But there’s more you can do! So, for example, I want to look what’s in there. Okay. I just double-click it and Django queries for me…
08:42 and gives me the output. I can inspect my database right here. So I can see, I have three entries in there, and that’s what they look like. Okay! And I can go ahead and I can edit it. I can say, “All right, maybe that’s not a Django project.” I can change that and see the change.
09:00 You can see that it’s blue, so it hasn’t yet been applied, but I can make changes like this to the database and then click this submit button, I guess it’s called Submit. Let’s see what it says—Submit, yeah.
09:12 And this pushes the changes back to the database. So now I just made a change in here and edited my database file. Very simple, like in a spreadsheet kind of way that is intuitively understandable.
09:23 If you love SQL, you can also just go ahead and press this…
09:28
open up a console, and then type some SQL in here! So you can say SELECT * FROM
(select everything from)—and then we again have autocomplete, so PyCharm just gives us this. So I want to see everything from—what did we just look at? projects.Project
, I think it was.
09:48 Yeah? So I write my SQL statement, I can execute it, and here’s my output down there. Of course, you can write any sort of SQL. Like, you can filter—whatever you can do.
10:00 You can do everything right out of PyCharm. All right, so that’s the database integration, something I wanted to show you, and that finishes up our quick overview of other useful features that PyCharm offers. I think all three of them are very, very powerful, and something that can help you a lot—especially when you’re working with big web projects. If you use a web app, you always have lots of files, so that’s where the project-level understanding helps in PyCharm. You can move between the different files. You are going to have to work with different technologies, so it helps that PyCharm is multilingual and understands all those different things out of the box and has syntax highlighting and autocompletion, et cetera.
10:37 As well as you’re probably going to work with a database, so having this integration and being able to intuitively inspect the database and even make changes and use SQL queries right out of PyCharm as well.
10:48 Everything in one—that’s very helpful. And that’s, I think, where PyCharm excels at. All right! So that’s it with the additional features. If you got excited about PyCharm and you want to learn more, in the next video we’re going to talk about what could be good strategies to get more familiar with such a complex IDE. See you there.
Become a Member to join the conversation.