Nautobot Network Automation Platform
Nautobot is an open source network source of truth and automation platform built on Django. It provides a highly extensible data model for network inventory, IP address management (IPAM), and device configuration, alongside a powerful framework for custom automation jobs and plugins. The current version is 3.1.0, with frequent patch releases across major versions (2.x, 3.x) and a new major version released approximately every 6-12 months.
Common errors
-
django.db.utils.OperationalError: FATAL: database "nautobot" does not exist
cause Nautobot requires a PostgreSQL database that has not been created or the connection details in `nautobot_config.py` are incorrect.fixCreate the PostgreSQL database and user, then update `nautobot_config.py` with the correct database connection details and run `./nautobot-server migrate`. -
Your installed PostgreSQL version (X.Y) is not supported by Nautobot 3.1. Minimum required is 14.0.
cause Attempting to run Nautobot 3.1 or later with an older, unsupported PostgreSQL version.fixUpgrade your PostgreSQL server to version 14.0 or newer to meet Nautobot's requirements. -
ModuleNotFoundError: No module named 'nautobot.dcim.models'
cause This error typically occurs when Python code attempting to import Nautobot models is run outside of a properly configured Nautobot/Django environment, or if `nautobot` is not installed.fixEnsure `nautobot` is installed (`pip install nautobot`) and run your Python script within the Nautobot context (e.g., as a custom job, plugin, or via `./nautobot-server shell`). -
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings have not been configured.
cause You are trying to use Django components (like models) without properly initializing Django's settings. This is common when running standalone scripts.fixFor standalone scripts, it's recommended to interact via the `nautobot-server shell` or create a custom Nautobot Job or Plugin. If truly necessary for a standalone script, manually set `os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'nautobot.core.settings')` and call `django.setup()` before importing Django-dependent modules, though this approach is often fragile.
Warnings
- breaking Nautobot 3.1 drops support for PostgreSQL versions 12.x and 13.x. A minimum of PostgreSQL 14.0 is now required.
- breaking Nautobot 3.1 upgrades its core Django dependency to Django 5.2. This may introduce breaking changes for custom plugins or apps that rely on specific Django versions or deprecated features, particularly if they are not actively maintained.
- gotcha Security updates in patch releases often mention indirect dependencies (e.g., `pygments`, `pyasn1`, `pyjwt`) that do not automatically update with `pip install --upgrade nautobot`. You must manually update your Python environment's global or virtual environment dependencies.
- gotcha Significant API changes can occur between major Nautobot versions (e.g., from 2.x to 3.x), particularly affecting plugin and job development due to underlying Django and Django REST Framework upgrades. Existing custom code may require substantial refactoring.
Install
-
pip install nautobot
Imports
- Job
from nautobot.extras.jobs import Job
- Device
from nautobot.dcim.models import Device
- IPAddress
from nautobot.ipam.models import IPAddress
- PluginConfig
from nautobot.extras.plugins import PluginConfig
Quickstart
from nautobot.dcim.models import Device
from nautobot.extras.jobs import Job
# Example: A simple job to list devices
class MyFirstJob(Job):
name = "My First Nautobot Job"
description = "A simple job to list devices and log their names."
task_queue = "default"
def run(self, data, commit):
self.log_info(message="Starting MyFirstJob...")
devices = Device.objects.all()
self.log_info(f"Found {devices.count()} devices in the database.")
for device in devices:
self.log_info(f"- Device: {device.name}, Status: {device.status}")
self.log_success("Job completed successfully!")
return "Success"
# To make this job available in Nautobot:
# 1. Save this code as 'my_job.py' (or similar) in a directory configured for Nautobot jobs.
# 2. In the Nautobot UI, navigate to Jobs, find 'My First Nautobot Job', and click 'Run'.
# This quickstart demonstrates how to define a Job that interacts with Nautobot models
# and is executed by the Nautobot platform.