Mastering PyCharm Transcripts
Chapter: PyCharm Projects
Lecture: Concept: Classifying directories
0:01 We've seen for large applications or large directory structures at least
0:05 this concept of marking a directory as some sort of thing is really helpful,
0:11 this is especially helpful in the web actually.
0:14 So we go over here and we right click on the directory
0:17 we say mark directory as, we get these 4 choices here
0:19 so let's look at the 4 choices:
0:22 the first one is sources roots,
0:24 so this contains all the actual source code and files
0:27 and PyCharm uses this as the point for resolving imports.
0:30 We saw in our example that I tried to import some things from actors
0:34 like the wizard and the dragon and stuff
0:37 from the actors in that little silly game I created,
0:39 and it said there's no actors, I went up to the top of this entire directory structure
0:43 and said there's no module called actors,
0:46 but it was right next to it right,
0:48 so I said look this is actually where these files refer to each other
0:50 by saying market as a sources root.
0:53 We also have resource roots, this is for static things
1:00 so this is actually super helpful for the web
1:04 because when you create things like Pyramid Web Apps
1:06 there's a whole structure that is not the exact same structure in the project
1:11 as it maps to the website, and because of that
1:15 PyCharm typically will tell you every single CSS file,
1:21 is not there and it won't help you with any sort of auto complete
1:24 in your HTML or your templates.
1:27 But, all you've got to do is right click and say mark it as a resource root,
1:31 and everything falls into place, so that's really handy for the web.
1:34 I don't really know how this would be used outside the web.
1:38 Excluded roots, these are things that PyCharm will basically ignore saying
1:42 don't look at this for trying to index stuff
1:46 or try to read these files and understand them,
1:51 so we did this for our virtual environment for example
1:54 as well as my little transcript folder,
1:56 those were just resources that were in the git project
1:59 but had nothing to do with our program really.
2:02 Finally, templates roots, this is just where you put
2:06 your Jinja 2 or your Chameleon templates in your web app
2:08 and when you create things like Pyramid web apps
2:10 you'll see that it actually automatically
2:13 marks the template folders as template folders
2:16 you have don't to do anything there, but for some reason
2:18 you've created one more by hand
2:20 and you want to indicate like, here's the template folder just use that.