RESTful and HTTP APIs in Pyramid Transcripts
Chapter: Your first service
Lecture: Running in pycharm
0:01 So it looks like we have Pyramid installed, our web app created,
0:04 registered, and we've been able to run it,
0:07 but it's no fun to have a web app if you can't edit it, right,
0:10 and we're going to use PyCharm to do that.
0:12 So let me show you how to configure this in PyCharm.
0:15 So basically we want access to the directory we're in
0:18 so I'll say open. on Windows it's start.
0:21 and here's the project structure that got created,
0:24 and in here, you can't see it, is the hidden.env
0:27 so on MacOS, I can drop this on PyCharm
0:31 and it will automatically open it up and understand this project,
0:35 I believe you've got to open PyCharm and say
0:38 file open directory on Linux and Windows.
0:40 So it comes to life you can see it's thinking about
0:43 all of the dependencies and libraries that are installed
0:46 so give it just a second to come to terms with that,
0:48 and notice it's also automatically detected
0:51 the project up here as a Pyramid project and it's created
0:55 what's called a run configuration, this requires PyCharm Pro,
0:59 PyCharm Community edition doesn't support web apps
1:02 or any sort of web development really,
1:05 so we can come over here and we can expand this out and see what we got;
1:08 Alright, this is what this is generated from our setup
1:11 we can just basically ignore that,
1:13 here's our hidden virtual environment, also ignore that,
1:15 but this is the stuff we really want to edit, here's our views,
1:18 here's our entry point with our routes, all of those kinds of things.
1:23 So I let's just go ahead and run it and make sure everything is working,
1:27 it is, everything is working, so if we click it
1:30 it should come up just like we did before on the command line.
1:33 All right, that's cool, now in case it doesn't come up like this
1:36 you may need to do a couple of things,
1:38 you may need to add a run configuration,
1:41 so you might need to come over here and say plus Pyramid server
1:44 make sure you don't do the default you just hit plus
1:46 and give it a name and you got to browse to the configuration file
1:49 I'll click here so you see give it a name,
1:52 browse to either the development or production any
1:54 set the working directory to be the same
1:56 and make sure you pick your virtual environment
1:59 if it's not there, you've got to go browse, I'll show you how to do that in just a second.
2:03 One final thing that will make life easier is say single instance only,
2:06 only one process can list on that port anyway
2:09 so you just get weird errors if you don't do that.
2:12 So the other thing you do is to go to settings, the preferences here
2:15 and if you go to the project, project interpreter you can see
2:19 you can actually go here and say add a local virtual environment
2:22 or even create a new one, but then you've got to run
2:25 the setup steps again in that new environment.
2:27 So if for some reason it doesn't show up,
2:29 then you can browse over to this, but as long as you follow
2:31 those naming conventions that I went through
2:34 .env for the virtual environment that it's in the root of your project here
2:39 then it should automatically detect it.
2:41 We also have a little terminal down here,
2:44 and the terminal automatically comes with that,
2:46 that virtual environment activated,
2:49 so you can come down here and a lot of that stuff that we did
2:51 with the setup.py and so on, down in this area.
2:54 All right, other than that, it looks like we're up and running and ready to go in PyCharm.
2:59 So, for the rest of the time working on this,
3:01 we'll basically be working in this editor.
3:03 Oh, one final thing before I go, notice it says that
3:06 the version control, the route was not registered,
3:09 so I can come down here, and I can add this
3:12 and this will add version control support to this project,
3:15 notice how everything turned red, that's because it's not yet committed,
3:19 it's not staged in get, so it hasn't been added basically.
3:23 So I've got to go through that, and then it will turn to either white or green
3:27 or blue depending on how I've edited it.