Setting up the admin interface

Now that a database is attached to the project, we can activate the administration interface of Django in it. The process is really simple at this point; you just need to uncomment a couple of lines of code in the project settings file and the main URL manager.

First, activate the Django application django.contrib.admin in the Installed_Apps section of the settings file:

Setting up the admin interface

Second, go to the urls.py file and uncomment the section that imports the admin class and that enables the admin's discovery of the models inside the project. Besides this, it is also necessary that we uncomment the last line of the URL pattern that manages the /admin/ path:

Setting up the admin interface

Now the Django administration application is activated in the project. If the operation is successful, you will be presented with the admin login page. After launching the application, navigate to the /admin/ page:

Setting up the admin interface

Insert the credentials created during the database setup to access the administration section:

Setting up the admin interface

Now we have a fully set up and working Django environment. Let's go ahead and create a new Django application in Visual Studio.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.134.198