Python for Entrepreneurs Transcripts
Chapter: Build web apps with Pyramid: Part 1
Lecture: PyCharm Demo

Login or purchase this course to watch this video and the rest of the course contents.
0:01 You've seen how to create a new pyramid web application on the command line
0:04 and we're going to do a little bit of follow up of that here,
0:07 but in this particular video, we're going to focus on how to work with PyCharm.
0:11 Namely, PyCharm professional;
0:14 let's switch over to PyCharm and see what we can do.
0:18 So the first thing I want to focus on is, let's just see
0:21 how that project we created with the command line
0:23 could be opened in PyCharm.
0:26 So if I come over here, you can see here's the web app
0:29 and remember, if you look over here, into this folder
0:33 that there's actually this invisible, hidden .env folder,
0:39 so with all that in place, if I drop this on to PyCharm,
0:45 it's going to open it, on Linux you have to say file open directory
0:49 and then just find that directory,
0:51 we can open it up and it's already got it; now notice, there's a couple of things,
0:54 first it's doing some indexing the very first time it's seen this virtual environment
0:57 so it can help, after this it should have that cashed and be much quicker.
1:01 So notice, it's already gotten a little pyramid logo up here,
1:05 and a play button, that's because it actually discovered this was a pyramid web app
1:09 and it's created what's called a run configuration that can run it,
1:13 that's because this is PyCharm professional,
1:17 if you don't have the professional edition, this is not going to work;
1:20 you can still go and create one and there's a video at the end of this chapter
1:23 showing you how to do it, but it's not going to automatically find this for you.
1:27 The other thing to notice is it's already found that virtual environment
1:30 so if you go down here, notice if I open up the terminal
1:34 and I ask like which Python, you can see it's already using that one that's in here.
1:39 When I run this, it's also using that one, you can see here.
1:44 There's the two things, we click this, boom it's working again.
1:47 So that's how to take the existing one
1:50 that we created outside in the command line and get it running here.
1:53 Let's start from scratch.
1:56 So let's take a step back and say we want to create a brand new project in PyCharm,
2:00 remember, this only works in professional,
2:03 see the other video if you are using community edition.
2:06 Okay, so we'll create a new project and down here we will pick pyramid
2:10 and it's got an old out of date interpreter, so that's all well and good,
2:14 let's tell it we want to put it into this project area on our desktop.
2:17 So I'm going to go here and then we'll give it something not just that
2:21 we're going to say this is going to be my_pycharm_app or something like this
2:25 we're going to pick chamelon, these are hidden
2:29 you might need to push them down,
2:32 starter is the scaffold that we\re looking for,
2:34 chameleon is the template language and this is all perfect;
2:37 this virtual environment is not great, so let's go and create one,
2:39 so we'll say create a virtual environment
2:42 and where do you want to create it, we're going to create it here.
2:46 And I'm not going to call it project area, I'm going to call
2:55 let's say /my_pycharm_env, do it like this,
3:01 now this is super important, don't forget to turn this off for python 2
3:04 you want python 3, really important.
3:07 So, we'll pick Python 3, we'll hit okay, it's going to create a new one
3:11 you can see it's installing all the things that we need,
3:14 okay, everything is ready to roll, it's pointing out
3:17 hey notice the pyramid is not installed into this virtual environment yet,
3:20 of course not, but it's going to install of course,
3:23 so we hit create, now it's going to go ahead
3:27 and install pyramid just stand alone for us
3:30 and once it's done indexing these files
3:32 which of course is going to cash again afterwards,
3:35 it says this project is not installed for development,
3:38 so you should run setup.py develop, so let's just click that.
3:43 Notice it also has package requirements are missing
3:46 but by running the development setup it's going to
3:48 basically hit both of those issues and take care of them.
3:51 Boom, everything is set up, the project is set up,
3:54 the dependencies are installed, the run configuration is set
3:58 the run configuration is set to run, that virtual environment
4:01 again if we look in the terminal down here,
4:03 there's our virtual environment we had it create
4:06 if we hit run, it's running that virtual environment
4:08 and there it is once again up and running.
4:11 In this case, it's not generated by cookiecutter it's generated by PyCharm.
4:16 So, using PyCharm is a pretty nice way to get started
4:19 when I first started working with pyramid and was newer to Python
4:23 I would use this a lot, now I find myself using the command line version
4:27 and then opening it like I showed you
4:29 right at the beginning of this video in PyCharm,
4:32 whatever makes you happy, they're all basically equivalent.
4:34 All right, now our app is created, up and running,
4:37 we're ready to start adding features to it.