Where to put Django startup code?
问题 I\'d like to have these lines of code executed on server startup (both development and production): from django.core import management management.call_command(\'syncdb\', interactive=False) Putting it in settings.py doesn\'t work, as it requires the settings to be loaded already. Putting them in a view and accessing that view externally doesn\'t work either, as there are some middlewares that use the database and those will fail and not let me access the view. Putting them in a middleware