Starting a Django App
00:05 Now remember, when creating a Django project you’ve got this basic project structure with a management app. And what are you going to do now in this lesson is run the command to create one of these blue squares, a Django app. And also, like I mentioned earlier, you can make more of those inside of your Django project and they’re all going to work with the same command.
That command is the following:
python3 manage.py startapp and then the name of the app. You can see that here you’re using the
manage.py file that you created when creating your Django project and you’re using this one to run something called
startapp and then passing it as an argument the name of the app that you want to create. In this example, I’m going to use, as the name for the app, I’m going to say
You see that here I have the project structure that got created when running
django-admin startproject . with the dot at the end. So,
manage.py and the management app
setup/, they sit directly in the current working directory that I’m in.
01:57 That is always going to be the same for whatever app you’re going to start moving forward. It’s going to take the name that you pass and then create this selection of beautiful and useful Django files that you will work with when you build your project. Now I want to show you that I can make more than one of these and that it’s going to have the same structure, so if I create a second app in my Django project, it pops up again on the same level as the management app and the other app that I created before, and both of these have the same content.
02:40 Here’s a bit of setup already done for you that just relates to the name that you gave. But most of it is just a single import and then a comment that gives you a hint of what you’re supposed to do in here. Now, these comments—this one doesn’t say very much, if you don’t know what a model is it’s not going to be that helpful—but keep in mind that there’s a lot of nice tips that already come with Django.
03:07 And I actually encourage you to go and explore this folder structure some more. Go and create a couple of apps, delete them, look around inside, figure out what you can find out of what these files are probably meant for.
Maybe you have some experience with Django already, and otherwise you can learn a lot by just poking around a bit. For example, going to the
settings.py file in your management app, you can see that there’s a lot, a lot of comments that give you information about what the different settings do. So just read up on this a bit, spend some time on it before moving forward, because at this point you’re pretty much done with your setup and now you’re ready to start implementing your own functionality that you need.
03:50 So as a quick recap, what you did here is you started a Django app, so beginning with a Django project structure and a management app that you created in the previous lesson, you now made this blue square a Django app, and you can make more of those. But essentially, at the point when you have your Django project with the management app and one additional app, you are at the state of where you’re ready to start working on the individual functionality of your Django web development project.
04:35 We’re going to walk through all of those steps and you can also use this video as a little command reference if you want to refresh the different steps and the related commands that you need for them. See you in the next lesson!
Become a Member to join the conversation.