#100DaysOfCode in Python Transcripts
Chapter: Days 97-99: Building JSON APIs
Lecture: Getting started: Program structures

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Alright, so let's get our project ready
0:02 and everything set up here.
0:04 So I'm over here in the GitHub repository and
0:09 Day 97 to 99 in the demo app.
0:12 So, what I want to do is just create a
0:14 virtual environment and then
0:15 we'll do the rest from within PyCharm.
0:21 Okay, so we can just open this folder
0:22 on Windows you would type "start."
0:25 on Mac you type "open".
0:31 So here we have our empty app and we've done this
0:33 many, many times throughout this course
0:36 but this time is different.
0:37 We want to actually have two separate applications
0:40 contained within this project.
0:43 Let's go and create a folder for the client
0:48 and let's create a folder for the web.
0:52 Alright, so there's our client, there's our web,
0:54 each one of these is going to have it's own
0:56 set of requirements, so let's go ahead and add those.
1:06 Okay, this is a pretty good start.
1:08 So we have our set of requirements for a client
1:10 and we have the set of requirements for the web.
1:14 And notice we have our virtual environment active here
1:17 and if we ask what is installed,
1:20 there's nothing, of course.
1:22 So we're going to entirely focus on the beginning.
1:25 Just on the web application, okay?
1:28 So we're going to close up this client here but before
1:31 we do there's one really quick thing we should do.
1:33 When we have files over here,
1:35 we kind of want to treat this as the whole project, right?
1:38 You might have a api.py and a program.py
1:41 and the program might import api.
1:43 In order for that to work easily in PyCharm is what we
1:46 need to mark this directory as the source's root,
1:48 say this is kind of its own little area.
1:50 Same thing for web.
1:53 It's effectively adding that thing to the Python path
1:57 and making that the working directory and things like that.
2:00 Okay, so, this is just the basic stuff
2:03 that we've got going on here.
2:06 Alright, that's the web one.
2:07 We're going to tell the web one
2:08 that we require Flask and SQLAlchemy.
2:11 Those are the things that we're going to need.
2:14 So, we'll go over here to web.
2:18 pip install -r requirements.txt
2:20 install everything in that file.
2:26 And last thing, let's go ahead and add an app.py
2:31 this is pretty standard in Flask
2:32 and we'll just print Flask coming soon.
2:37 And let's go ahead and run this.
2:39 Yay, Flask is coming soon.
2:41 Let's get this run configuration set up
2:43 for a few good things here.
2:45 So we'll go over here and say
2:46 this is going to be the web app.
2:49 And we also want to have it restart
2:51 because the web apps open a port,
2:53 this one will be port 5000 and if you try to run
2:56 a second one without closing this one it'll crash,
2:58 so this will tell PyCharm obviously to do that correctly.
3:01 Alright, well, I think our structure is in place.