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