#100DaysOfWeb in Python Transcripts
Lecture: Interlude: Python Tips API back-end setup
0:01 In this video, we take a quick detour
0:03 to get the Python Tips API set up locally
0:06 so we can query it from our front end.
0:09 So I got this repo here on PyBites
0:12 which is Python_Tips
0:14 and we're going to clone it to our local directory.
0:20 So I go to code and I clone it here
0:31 cd into it.
0:35 And to make a virtual environment
0:38 install the requirements.
0:51 Set a secret key for Django
0:59 reactivate the virtual environment.
1:02 I run my migrations
1:07 which will be synced to a local SQLite3 database.
1:11 I make a super user.
1:22 And I have a script here in tips, management
1:28 commands, sync tips.
1:31 And that will reach out to the PyBites tips website
1:35 and it's going to scrape it
1:36 and import all those tips in the local database.
1:41 So let me run that now.
1:49 95 tips imported.
1:51 Let's run the server
1:55 and let's do a curl to 127:8000 API
2:04 and let's say, Tip 10.
2:07 Anywhere you go, you see a dictionary of tip
2:10 code, and a link, and a share link.
2:15 It could be 12, 85, et cetera.
2:21 And this should get them all.
2:23 This gets a whole bunch of tips.
2:26 So this is cool. Now we have our API running.
2:28 And I can now further build out the front end
2:31 to query this API and show the tips on the website.
2:35 But before doing that
2:36 let's introduce classes in React
2:40 and keeping track of state.