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