[Answered ]-Use Django ORM in locust

1👍

You can actually import your Django setup by setting up your django settings module.

import os

os.environ["DJANGO_SETTINGS_MODULE"] = "{app}.settings"

import django

django.setup()

from myapp.models import Group
...rest of your locustfile code

Remember to change {app} to your app with the settings.py file.

Then run the locustfile by locust -f path/to/locustfile.py

Leave a comment