1👍
✅
Well, the problem in fact is that you want to run some custom code when your server starts up.
Two possibilities:
- Use
wsgi.py
as suggested by this post. This seems to be the more elegant solution. - Put all your code inside some
__init__.py
file. Be warn that this code will be executed any time you import that package (for example, when you run a django command)
Source:stackexchange.com