#100DaysOfWeb in Python Transcripts
Chapter: Days 37-40: Introduction to Pyramid framework
Lecture: Creating the app: Intro
0:00 Let's talk about how you get started
0:01 with a Pyramid project, creating a new one from scratch.
0:04 Now this is a little bit more involved than Flask
0:07 because Flask just says create a Python file
0:09 but it gives you no help.
0:10 You'll see that the way we start here is going to push us
0:12 way farther down the line in terms of structure.
0:14 We'll have static folder and places for our CSS
0:19 places for our templates and so on.
0:21 So we're going to get started
0:22 by using this package called Cookiecutter.
0:24 It'll let you install and create
0:25 arbitrary templates for new projects.
0:29 Some of these are Python, like there's some for Flask
0:31 and Django and of course Pyramid
0:33 but there's also stuff for even weird things like Atari.
0:35 It just generates a bunch of files in a well-known structure
0:39 by asking you a couple of questions.
0:40 We're going to use Cookiecutter
0:41 to start way farther down the path
0:43 with the right structure for our project.
0:45 Then once we have Cookiecutter installed
0:47 and set up in our path, if it's not
0:50 we're going to use Cookiecutter to create the starter site.
0:53 There's about four or five different Cookiecutter templates
0:55 that we can use, and I'll talk about those.
0:56 We can use any of them to create our starter site
1:00 depending on what we want to start from.
1:02 Then we're going to create a virtual environment
1:05 around this project.
1:06 This is good advice for any of the web frameworks.
1:08 They all have dependencies and things like that
1:11 and you're way better off having a single dedicated
1:14 Python environment for that web application
1:16 so we'll do that.
1:17 Pyramid is a little special in that it wants you
1:19 to treat the website as a Python package.
1:23 You don't have to know much about Python packaging
1:25 but you do have to run a separate command
1:27 basically to tell the Python runtime.
1:29 CPython, hey when you're looking to run this website
1:32 it lives right here.
1:33 So we're going to run a certain command to do that.
1:36 And then it's time to just start working on our site.
1:39 The first four steps, we do that to get started
1:41 then we serve it up
1:42 figure out what features we want to add, test them
1:45 and then serve it up again, see if that worked
1:48 add more features, and we just keep evolving it.
1:50 So this is the general workflow
1:51 of working with Pyramid from the command line
1:55 from a tool that doesn't have native Pyramid support.
1:57 If you're talking about PyCharm
1:59 well, that's like click a button
2:01 and answer a question or two and you're off to the races.
2:04 But I want to make sure we go through
2:05 the command line version first
2:07 so that you see everything that's happening
2:09 just in case something goes wrong
2:10 you will know kind of of what you need to do.
2:12 And then of course if you just prefer
2:13 to click the button in PyCharm, go for it.