RESTful and HTTP APIs in Pyramid Transcripts
Lecture: Lightning review: Creating the service
0:01 Next, we created our first service.
0:03 Remember, we were going to help out this dealership,
0:05 they were looking a little retro, they didn't have a good api,
0:07 they wanted to get in the game and actually start selling some cool Opels,
0:10 and get a little bit of European flair in small town America here,
0:14 so we were going to create an api that let them list and sell
0:17 and generally participate in a technology's way with their Opel cars, all right.
0:23 So that was our service, first thing we had to do to create the services
0:27 is have a web app to run it in at all,
0:29 so in order to create the project, it's technically not required
0:33 but it makes life way, way easier, we were going to use cookiecutter,
0:37 so we had to install a cookiecutter on our machine,
0:40 and you could even give that a --user if you just want to install it in your profile
0:43 and then, we're going to run cookiecutter
0:45 and pick the pyramid cookiecutter starter off of github.
0:49 That's going to ask us a bunch of questions and generate the web application
0:52 with all the stuff set up and ready to go.
0:54 Then, we chose the name auto_service_api, at least in this little example here
1:01 and so we we were going to go into that folder,
1:03 create a hidden .env, virtual environment with the --copies don't forget that,
1:09 if you're on MacOS that can be very helpful;
1:13 and then, we want to activate this, we could do this in one of two ways,
1:16 if you want to continue to work on a command line, you will do it here,
1:20 in PyCharm, we saw that actually opening the auto_service_api folder
1:24 it would detect that hidden .env and just cling on to it
1:27 and make that the default one for the project that's going to create,
1:30 so either way we'll activate it here or open in PyCharm,
1:33 and then we need to run the setup.py with the development command,
1:36 you might normally run it with install, but here we're going to run it with develop
1:39 so it leaves the files in place, but executes them out of our working directory.
1:44 And then we can run it just say p.serve development.ini
1:48 and we should have our app up and running if we did everything correctly.