Configuring a new web service
We added a new Django app to our existing Django project. Use your favorite editor or IDE to check the Python code in the apps.py
file within the restful01/drones
folder (restful01\drones
in Windows). The following lines show the code for this file:
from django.apps import AppConfig class DronesConfig(AppConfig): name = 'drones'
The code declares the DronesConfig
class as a subclass of the django.apps.AppConfig
class that represents a Django application and its configuration. The DronesConfig
class just defines the name
class attribute and sets its value to 'drones'
.
Now, we have to add drones.apps.DronesConfig
as one of the installed apps in the restful01/settings.py
file that configures settings for the restful01
Django project. I built the previous string by concatenating many values as follows: app name + .apps.
+ class name, which is, drones
+ .apps.
+ DronesConfig
.
Note
We already added the rest_framework
app to make it possible for us to use the...