Django EVE Online SDE
Django-eveonline-sde provides Django models for the EVE Online Static Data Export (SDE), allowing developers to easily integrate SDE data into their Django projects. It includes management commands to download and import the SDE. The current version is `0.0.1b9`, and it's under active development as a beta project by the Brave Collective, with updates released on an irregular basis as features are added or refined.
Common errors
-
ModuleNotFoundError: No module named 'eveonline_sde'
cause The `django-eveonline-sde` package is either not installed or not added to your Django project's `INSTALLED_APPS`.fixEnsure you have run `pip install django-eveonline-sde` and added `'eveonline_sde'` to your `INSTALLED_APPS` list in `settings.py`. -
django.db.utils.ProgrammingError: relation "eveonline_sde_invtype" does not exist
cause The database migrations for `eveonline_sde` have not been applied, or the SDE data has not been imported yet.fixRun `python manage.py migrate eveonline_sde` to create the database tables. If tables exist but are empty, run `python manage.py download_sde` followed by `python manage.py import_sde` to populate them. -
OperationalError: unable to open database file (when using SQLite)
cause SQLite has locked the database file, or the Django process does not have write permissions to the database file or its directory, especially during SDE import.fixEnsure the user running `python manage.py import_sde` has full read/write permissions to your SQLite database file and its parent directory. If the issue persists, try stopping any other processes that might be accessing the database before running the import.
Warnings
- breaking As a beta package, database schema changes might occur between minor versions. This could require new migrations or even a full SDE re-import.
- gotcha The EVE Online SDE is very large. Downloading and importing it into your database can take a significant amount of time and consume substantial disk space (several GB).
- gotcha SDE data updates are not automatic. You must manually run `download_sde` and `import_sde` management commands to get the latest SDE version.
Install
-
pip install django-eveonline-sde
Imports
- InvType
from eveonline_sde.models import InvType
- TypeCategory
from eveonline_sde.models import TypeCategory
- SolarSystem
from eveonline_sde.models import SolarSystem
Quickstart
# settings.py
INSTALLED_APPS = [
# ...
'eveonline_sde',
# ...
]
# Run migrations
# python manage.py migrate eveonline_sde
# Download and import SDE data
# python manage.py download_sde
# python manage.py import_sde
# Example usage in a Django shell or view
from eveonline_sde.models import InvType
try:
tristanium = InvType.objects.get(name='Tristanium')
print(f"Tristanium Type ID: {tristanium.type_id}")
except InvType.DoesNotExist:
print("Tristanium not found. Did you import the SDE?")