Django Eve Universe

1.6.1 · active · verified Fri Apr 17

Django Eve Universe provides a complete set of Eve Universe models, allowing easy access to EVE Online universe data fetched on-demand from ESI. It enables storing, caching, and updating critical EVE Online static data within a Django project. The current version is 1.6.1, and it maintains an active release cadence with regular updates and bug fixes.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates basic retrieval of Eve Universe models like `EveType`. After installing `django-eveuniverse` and adding 'eveuniverse' to `INSTALLED_APPS`, you must run `python manage.py migrate` and then `python manage.py eveuniverse_load_data` to populate your database with universe entities. The `EVEUNIVERSE_DATA_SOURCES` setting in your Django `settings.py` determines which entities are loaded.

import os
import django
from django.conf import settings

# Minimal Django setup for quickstart demonstration
# In a real Django project, this setup is handled by manage.py
if not settings.configured:
    settings.configure(
        INSTALLED_APPS=['django.contrib.sites', 'eveuniverse'],
        DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}},
        SITE_ID=1,
        EVEUNIVERSE_DATA_SOURCES={ # Configure at least one source for data loading
            'eveuniverse.EveType': {'priority': 100, 'enabled': True}
        }
    )
    django.setup()

from eveuniverse.models import EveType

# In a real setup, you would run 'python manage.py migrate'
# and then 'python manage.py eveuniverse_load_data' to populate the database.
# For this quickstart, we assume data is already present.

try:
    # Example: Retrieve 'Tritanium' (a common EVE mineral)
    tritanium = EveType.objects.get(name='Tritanium')
    print(f"Found Tritanium: ID {tritanium.id}, Group: {tritanium.eve_group.name if tritanium.eve_group else 'N/A'}")

    # Example: Retrieve 'Jita' solar system (which is an EveType)
    jita_system_id = 30000142
    jita_system = EveType.objects.get(id=jita_system_id)
    print(f"Found Jita system: {jita_system.name}")

except EveType.DoesNotExist:
    print("One or more Eve Types not found. Ensure you have run 'python manage.py eveuniverse_load_data' after setup.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →