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: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?
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.
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,
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.
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.
Okay, so that’s all for now inside of
settings.py. Remember, once you create an app, you want to go into
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.
Become a Member to join the conversation.