Django Integration

ChatterBot has direct support for integration with Django’s ORM. It is relatively easy to use ChatterBot within your Django application to create conversational pages and endpoints.

Install packages

Begin by making sure that you have installed both django and chatterbot.

pip install django chatterbot

For more details on installing Django, see the Django documentation.

Installed Apps

Add chatterbot.ext.django_chatterbot to your INSTALLED_APPS in the settings.py file of your Django project.

INSTALLED_APPS = (
    # ...
    'chatterbot.ext.django_chatterbot',
)

Migrations

You can run the Django database migrations for your chat bot with the following command.

python manage.py migrate django_chatterbot

MongoDB and Django

ChatterBot has a storage adapter for MongoDB but it does not work with Django. If you want to use MongoDB as your database for Django and your chat bot then you will need to install a Django storage backend such as Django MongoDB Engine.

The reason this is required is because Django’s storage backends are different and completely separate from ChatterBot’s storage adapters.