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