Home > Articles > Open Source > Python

  • Print
  • + Share This
This chapter is from the book

Installing an Application

After you have configured and synchronized the database, you can begin installing applications in it. Installing applications is simply a matter of creating an application directory, defining a model, and then activating the application so that Django can access it in the database.

Creating a Model

After the application has been created, you need to create a model for the data that will be stored in the application. A model is simply a definition of the classes, attributes, and relationships of objects in the application.

To create a model, you need to modify the models.py file located in the application directory. The models.py file is a Python script that is used to define the tables that will be added to the database to store objects in the model.

The models.py file initially has only one line, which imports the models object from the django.db package. To define the model, you need to define one or more classes. Each class represents an object type in the database.

  • + Share This
  • 🔖 Save To Your Account