Create a Django Project
In this video, you’ll create a Django project using the
django admin command. You can use your terminal window, just as you did in the previous lesson.
Start by running the
django admin command with
startproject, followed by the name of the project, which in this case is
portfolio. If you put a period (
.) at the end of the command, then you can avoid creating an extra folder.
In this video, we will create a Django project using the
django-admin command. Just to make sure you know this, you can use your terminal window just as you did before and to make all this happen, as you want. I’m going to stop using the terminal like this now, and instead, I’m going to use it inside of PyCharm, down here, but that’s just another terminal window, right? It’s just integrated in PyCharm, which makes it a bit easier for us to see everything that’s going on. All right!
So, the first thing we want to do, is we’re going to use the
django-admin command. I can always autocomplete, use the Tab character so that you know what’s going on. I’m going to use
django-admin, which got installed when we installed Django into our virtual environment.
And here’s a little trick that’s actually very helpful: if I would just run this command like this without anything else, Django is going to create a folder structure that makes a project for the portfolio and then a management app inside of it called
So, we already have a folder called
django-portfolio, which is going to hold our whole project. I don’t want to repeat this structure again, and the trick to avoid doing that is by just adding a little
. generally stands for something that happens inside of this current directory. In this case, it’s the same. It just avoids creating an extra folder and instead just makes the management app that we’re going to call
portfolio inside of the folder that we created before.
So, let’s run this. That went pretty quick. Take a look here. After it refreshes, we can now see that inside of this folder, we have a new one that popped up called
portfolio, as we named it here.
02:00 This is the management app for our Django project. So, a Django project, as we talked about in Part 1, consists of multiple apps, or at least one. This is the management app, which holds the settings file, and is the first access point for anything that the user types in the URLs, and it also contains the WSGI file.
We get a bit of information here that we don’t have to worry about right now, but it also tells us that it’s starting the development server at
8000. This is where Django starts its development server.
Become a Member to join the conversation.