[Answer]-Validating django models on runserver command

1👍

Well, the problem in fact is that you want to run some custom code when your server starts up.

Two possibilities:

  1. Use wsgi.py as suggested by this post. This seems to be the more elegant solution.
  2. 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)

Leave a comment