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:
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:
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:
Insert the credentials created during the database setup to access the administration section:
Now we have a fully set up and working Django environment. Let's go ahead and create a new Django application in Visual Studio.
18.219.134.198