Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Chapter: Your first Pyramid site
Lecture: Concepts: CLI starter site
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
So you've seen how to create a Pyramid website using Cookiecutter, virtual environments and what not on the command line. Let's review those steps
0:09
so that you have a nice, clear series to follow. Okay, so, what do we do? We started by sayin' we're going to use Cookiecutter
0:17
and we're going to need a template to work with. So I use the Pyramid Cookiecutter starter template.
0:21
Just copy that URL and we're going to feed it to Cookiecutter,. You can use any one of the five actually
0:27
if you feel they match what you're doing better. So we got to make sure we have Cookiecutter installed. So pip install cookiecutter
0:35
maybe throw a -U for upgrade a --user so it doesn't require sudo things like that. But here we go it's going to get it going. That's great.
0:45
We pip install cookiecutter and then we're going to create the scaffolding. We want to create the site using Cookiecutter.
0:52
So we'll say cookiecutter and we'll give it the URL to the template. It's going to ask a bunch of questions. If you want to follow along
0:59
make sure you choose 2 here for your project otherwise there's going to be trouble. Alright, great, so you choose that you answer the various questions
1:08
and it gives you a few steps to follow after that. It says go to the project, create a virtual environment. Make sure you upgrade pip inside of tools
1:17
because Python doesn't do that for you. How frustrating but that's the way it goes. And then, once you've registered the project
1:26
we'll be up and running and then you can serve it up. Oh, what's that look like? Well, we're going to run Python3 -m venv.
1:36
Some versions of Mac and Python intersected with PyCharm all require this --copies. If you have the latest version of everything
1:45
you don't need it but you can throw that on there if you're finding you're having trouble. So we're going to create our virtual environment
1:51
and we can activate it. Say source .env/bin/activate on Mac or Linux on Windows it's just .env\scripts\activate.bat
2:02
and then you can ask well which Python or where Python should be the one in your virtual environment. Then final step is to install the dependencies
2:10
install Pyramid, and to register the site with Python. So Python setup.py develop. Everything should be up and running and working.
2:22
It's just time to serve up your app. Open the web server and start interacting with it. So pserve and give it one of your configurations
2:30
probably development.ini. What'd you get? Well you get your site up and running of course. So really nice, here we are on the close
2:38
looking at our starter project just like we did in the demo.