I'm trying to write some code that checks on something, if exists then cool and if not creates it.
The problem is, where to put this code? Django doesn't recommend putting anything that deals with DB at an app's ready()
function - this is what I'm currently doing but it gives me an error on debugging and give an error too on the beginning but works later on-.
Also, what I have found seems outdated and a bit hacky like putting it at urls.py
or wsgi.py
.
I feel there must be a better way to do it.
Thank you all.