Building data-driven web apps with Pyramid and SQLAlchemy Transcripts
Chapter: Routing and URLs
Lecture: Demo: Routing, loading the project
0:00 Alright let's start writing some code to do with routing.
0:03 Let's being by reviewing the Git repository.
0:07 Now we have Chapter 6 that's the chapter that we're on
0:10 and again, here is an exact copy
0:12 of what we're starting with.
0:13 This is just copying over Chapter Five's
0:15 materials the template stuff.
0:17 It's going to stay that way, this one is the one
0:20 I'm going to work on, so this one is changing.
0:22 Now, I'm not going to go over and
0:24 over again setting up this in PyCharm.
0:27 If you need help with that be sure to check out the previous
0:30 previous chapter where we did that.
0:32 But I will show you one quick thing
0:34 I'll go ahead and go through the steps and have a shortcut
0:36 for the rest of the things going on here.
0:38 So let's go over to this folder.
0:42 Now over here remember where the development.ini
0:45 and production.ini there's no venv
0:48 There's no virtual environment.
0:49 And there's a couple of steps to go through
0:51 creating it and activating it and it's also
0:54 good to update pip and setuptools cause
0:57 setuptools at the time of this recording is
0:59 11 versions out of date, oh my goodness.
1:01 So instead of typing that over and over again
1:04 I've created this alias venv, which runs
1:09 python3 -m venv, virtual environment called that
1:14 and then it's going to activate it
1:16 and then it's going to update the tools
1:17 and then just let you know it worked.
1:19 So I'm going to be running this from the rest of the time
1:20 and this is the thing I've created, it's not a Python thing
1:22 so either make a batch file, or put this in you
1:26 bash.rc or your .bashrc or zshrc whatever you're using.
1:33 Okay, look's like everything is good
1:36 notice it activated it, and even
1:40 got the new version right there.
1:41 Okay so we're going to just drop this under PyCharm.
1:46 Let's go ahead and add that vcs root.
1:50 Alright, in this chapter what we're going to do
1:52 is we're going to build up the routing URL structure
1:54 and the basic sort of layout in
1:58 terms of the views and what not.
2:00 We're not going to implement all of them, but
2:02 at least we'll get some place holders in place.
2:05 We'll just make sure things run and click down here
2:07 we should have our virtual environment. We do.
2:13 The one in routing looks like it's working.
2:16 Now remember for this to work, we also have to say
2:18 python setup.py develop, we can do that here.
2:23 Or we can go over here if we click.
2:25 in the right spot right there, see it runs setup task
2:29 develop would be the same thing.
2:35 Okay, you should be able to run this.
2:38 Looks like it's working let's
2:39 just make sure we can open it up, great.
2:42 Everything's good here's our fake data that we showed.