5 ms·
Without calling setup, you cannot import anything that touches Django models, like constants defined in a file that transitively imports a Django model. In pra
by yen223 7y ago
Without calling setup, you cannot import anything that touches Django models, like constants defined in a file that transitively imports a Django model.
In practice, this means that any script that depends indirectly on Django code will incur a lengthy startup cost (from having to call setup()), and will fail to run if there's no database connection, even if the script itself doesn't need the db.
- deleted 7y ago[deleted]
- heavenlyblue 7y agoYou can import Django models before calling setup, you will simply not be able to use the database before calling setup.