[Fixed]-Django AppsNotLoaded

1👍

Django must configure all installed applications before you can use any models. To do this you must call django.setup()

import django
django.setup()

From the documentation:

This function is called automatically:

  • When running an HTTP server via Django’s WSGI support.
  • When invoking a management command.

It must be called explicitly in other cases, for instance in plain Python scripts.

Leave a comment