Register the App
Before you continue, let’s take a look at the settings.py
file in Django. This file contains settings that are important for your Django application.
There’s a lot of code in this file, but you’ll address parts of it as you go along. For now, you don’t really need to worry about most of the code in this file.
00:00
Before continuing, I want to take a quick look together again at the settings.py
file in Django.
00:08
settings.py
contains a lot of—as you might expect—settings that are important for your Django application.
00:16 There’s a lot of stuff, so just looking at this at the beginning, you might be a bit overwhelmed and be like, “Oh, what’s all this code?”, just scroll over it quickly and feel overwhelmed. But it’s not that complicated, and we’re going to keep addressing parts of it as we go along. For now, you don’t really have to worry about it, okay?
00:33
So, there’s stuff happening and it’s important for Django to function, but we’re going to access it bit by bit when we actually need it. Okay? The first thing that we’re actually going to need from in here is this setting called INSTALLED_APPS
. You see, there’s a couple of them already here: the admin interface we mentioned earlier, some apps for authentication, content types, sessions, messages, and static files. Those are all things that come pre-installed with Django, so it’s functionality that comes with Django, built-in. What we want to do now, because we just created our own app, we want to register it here.
01:14
So, I just make a new line here. I’m going to take a little note for myself that tells me my apps
, they are going to happen from down here. And now, in the same way that these ones are set up, I’m just going to add my app here by typing its name, 'projects'
.
01:35
Just by doing this, I’ve registered my app in my Django project. Remember that portfolio
here is my management app, and settings that apply to the whole project need to be done in here. That’s why also the settings
file sits in here.
01:50
And one thing that we need is to tell our project, the whole portfolio project, that we now have an app that’s called projects
and that this projects
app is going to be part of our Django project.
02:04
Okay, so that’s all for now inside of settings.py
. Remember, once you create an app, you want to go into settings
, INSTALLED_APPS
, and then register it simply by typing the name of the app as a string. End of excursion, let’s head back to fixing up our routes.
Martin Breuss RP Team on March 9, 2020
The comma at the end of lists is not entirely necessary, but it has some advantages and is the recommended way of handling list items in Django.
Become a Member to join the conversation.
reblark on March 8, 2020
I would suggest that you point out that you placed a comma after ‘projects’