I'm brand new to Django and Python, and not sure how to get around this problem, but I know what's wrong and why...
I'm connecting to a MQTT broker (internet of things messaging protocol / provider) so I can update a webpage with data from some sensors I have.
I've started the MQTT service in my init as was suggested below, but I don't know enough to know if that's right or wrong, but it works.
https://stackoverflow.com/a/41017210/2408033
My problem happens, when I want to try to update my database with the messages I receive from the MQTT broker. I need to import my model so I can update it, but the model hasn't been loaded yet, and it throws the error - "Apps aren't loaded yet."
I was reading that you shouldn't attempt to import models before the Django setup has run (which is after init) so I'm not sure where / how to start the loop for the MQTT broker thread?
Where else can I place the code to start the loop where it won't be triggered a second time?