Python for Entrepreneurs Transcripts
Chapter: Build web apps with Pyramid: Part 1
Lecture: Running Pyramid in PyCharm Community Edition

Login or purchase this course to watch this video and the rest of the course contents.
0:00 So in the introduction when we talked about using PyCharm, I said you really should use the professional edition for this course.
0:07 Now, I know some of you out there are saying nope, I'm not doing it but you still want to try out and you're using the community edition
0:12 and I want to give you a little bit of help here, you can go to PyCharm community edition which is a hundred percent free
0:18 and easily open and run these pyramid web applications; let me show you. Here you can see I have PyCharm CE for community edition,
0:26 now here's the repository demos off of github that I've been working in and here's the first set of starter code,
0:35 so let's go ahead and just make a copy of that so I don't alter it, and I'll show you how to launch this in PyCharm community edition.
0:44 The first step would also launch it in professional edition, so we go over here and you want to have the directory selected
0:50 that has set up and development and production in it, that's true for all the versions of PyCharm
0:55 and this is really your root of your project for your website so I'm going to take this and drop it on PyCharm,
1:00 you can see it loads up the project, we don't really need to see the tips do we, this is a new virtual machine, I have not been using before
1:07 I wanted to start fresh, so you guys have exactly the same thing I do for this demo.
1:11 So here you can see the project and everything we've been working with at least in this edition, and if I drop this onto the professional edition
1:18 it is very possible that it would have a run configuration for pyramid, if it didn't I'd be able to go up here and hit edit and then I hit plus
1:26 and there would be something about pyramid and it would give me all the right options,
1:28 but this is the community edition, it doesn't support web apps, so let me just show you. So I'll pick an unnamed, just basic Python app,
1:38 and over here I'll call it web or something like that and set single instance only because that's really frustrating
1:44 and now the script, what script do I run, well first of all, there's a couple of things we still have to do to get everything ready
1:49 so let's look at my desktop, I'll just do this work on the desktop really quick, since this is not where things are staying;
1:58 so we have our two web starter project there, and in there we have the right folder, the one we just opened. We also want to have a virtual environment
2:05 so let me go ahead and make that instead of using the system environment. 02:12 So that makes the environment, and then we got to source activated
2:16 notice the prompt changes, and now we're going to need to set up our web app, really, what I need to complete the step behind me in PyCharm is
2:29 I need pyramid installed, but I'm also going to have to do all the other setup stuff, so let's go ahead and just take care of that.
2:38 And now that we have the virtual environments Python active we could just say Python develop, like that,
2:52 alright, it looks like everything got installed and set up correctly; the thing that we really need to see is if we ask for which p.serve
3:01 we should now have this p.serve script set up here. Ok, so now what we want to do is we're going to tell PyCharm to run that as the script
3:11 and the parameter we want to give it, is just going to be this file right here so let's get the path, here is a cheap little way to do it.
3:19 So we just come down here and we just pass the development.ini say run single instance, give it a name and we also need to give it an interpreter
3:28 so remember, we want to give it the one that we had just created so let's close this for a minute and register the other
3:36 the new one we just created with PyCharm, since I just created it, it doesn't know about this one
3:43 so let's go over here and say add local and grab it off the desktop. Now, we want to edit this, notice how it has the two processes running
3:56 it's basically indexing all the libraries in there, and you know how to run code well it's happening in PyCharm,
4:03 and so for whatever reason they don't let you edit your configuration. Here we go, now it's back, let's edit this, and we can just pick
4:09 the environment that we chose, ok so we registered our package in a virtual environment which installed p.serve as one of the dependencies
4:19 so now we can reference it, we also point to the development.ini or any other configuration file you might run
4:25 and we chose that same virtual environment, now we should be able to run it and see what we get.
4:31 Ta-da, look at that serving on this, we click it, that looks like pyramid to me. So now you can see how to set up and run pyramid web applications
4:42 in PyCharm community edition, like I said, it's not as powerful as the professional edition and I'd recommend you get it,
4:49 but if you don't want to get it here's a nice fallback case.

Talk Python's Mastodon Michael Kennedy's Mastodon