Autoloading modules in shell

Nov. 22, 2022

Suppose you have a django project with an application named yourapp with the following structure:

├── models

To autoload your models when running the python shell command create a file with the following content.

import logging


from yourapp.models import *  # noqa

Now when you run python shell your project models will be automatically available.