Effective PyCharm Transcripts
Chapter: PyCharm Projects
Lecture: Concept: Classifying directories

Login or purchase this course to watch this video and the rest of the course contents.
0:01 We've seen for large applications or large directory structures at least this concept of marking a directory as some sort of thing is really helpful,
0:12 this is especially helpful in the web actually. So we go over here and we right click on the directory
0:18 we say mark directory as, we get these 4 choices here so let's look at the 4 choices: the first one is sources roots,
0:25 so this contains all the actual source code and files and PyCharm uses this as the point for resolving imports.
0:31 We saw in our example that I tried to import some things from actors like the wizard and the dragon and stuff
0:38 from the actors in that little silly game I created, and it said there's no actors, I went up to the top of this entire directory structure
0:44 and said there's no module called actors, but it was right next to it right, so I said look this is actually where these files refer to each other
0:51 by saying market as a sources root. We also have resource roots, this is for static things like style sheets and images and Javascript and so on,
1:01 so this is actually super helpful for the web because when you create things like Pyramid Web Apps
1:07 there's a whole structure that is not the exact same structure in the project as it maps to the website, and because of that
1:16 PyCharm typically will tell you every single CSS file, every single Javascript file is not found,
1:22 is not there and it won't help you with any sort of auto complete in your HTML or your templates.
1:28 But, all you've got to do is right click and say mark it as a resource root, and everything falls into place, so that's really handy for the web.
1:35 I don't really know how this would be used outside the web. Excluded roots, these are things that PyCharm will basically ignore saying
1:43 don't look at this for trying to index stuff or try to read these files and understand them, so we did this for our virtual environment for example
1:55 as well as my little transcript folder, those were just resources that were in the git project but had nothing to do with our program really.
2:03 Finally, templates roots, this is just where you put your Jinja 2 or your Chameleon templates in your web app
2:09 and when you create things like Pyramid web apps you'll see that it actually automatically marks the template folders as template folders
2:17 you have don't to do anything there, but for some reason you've created one more by hand
2:21 and you want to indicate like, here's the template folder just use that.


Talk Python's Mastodon Michael Kennedy's Mastodon