RESTful and HTTP APIs in Pyramid Transcripts
Chapter: Your first service
Lecture: Running in pycharm

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


Talk Python's Mastodon Michael Kennedy's Mastodon