training 3

Managing Your Bestie I Django and PostgresQL Database

Django and PostgresQL integration found their way into the Bestie I for a number of reasons, including reliability when using concurrency, search speed for SQL databases, and the number of excellent tools for maintenance. For our purposes today, we’ll discuss how to access your database, and make changes to your entries without having to use the command line. Yay GUI!

First, you will need to log in to the Django Admin system. Go to http://{brain_ip_address}/admin/

There, you will see the login screen.

The initial username and password is located in our developer section.

PLEASE CHANGE AT LEAST YOUR PASSWORD THE FIRST TIME YOU ENTER THE SYSTEM.

You should now see a screen similar to what you see below:

Django and PostgresQL admin interface
  • A. Modify: If you want to modify any existing data
  • B. Add: You can freely add any data. Be sure to check out the Developer’s API Docs to understand dependencies.
  • C. Model: These are the models, the containers of data, stored in the database.
Django and PostgresQL Adding or Changing instances
  • A. Adding instance of type model: Add an instance to this database table. In this case, that would add a “brain_component”.
  • B. Perform action: These are are any actions to apply to checked instances. Here, you have the option to select an instance with the checkbox next to it’s name, and then perform an action of “Delete selected “brain_components”.
  • C. Instance of model: This is an instance of the model stored in the database.
  • D. Checkbox to show what model instance to perform action on: Selects something in the model to perform an action on. So if you wanted to delete all the items in this table, click on both check-boxes, and click the “Action”, select “Delete selected “brain_components”, and then click the “Go” button. It will ask you for a confirmation, and bam, does the work. DON’T actually delete these particular items. It will potentially bust your system.

From here, you should be able to quickly access any of your database entries through the Django and PostgresQL admin interface.

Most of your interaction with the database should come from the iOS app to start. However, if you don’t have the iOS app, or your using your own integration platform, this can be the fastest way to build out a system interface. You can create scripts to do this for you, but that topic is beyond our current scope.

One last cautionary note. This is for ADMIN access to your system. With this comes great responsibility. If you choose to go this route, you accept all the risk and liability with breaking your system. We don’t have a way to restore your system currently. Be VERY careful with this!