Bradley Kirton's Blog

Published on Nov. 22, 2022

Go home

Auto-loading modules in shell

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

├── models

To auto-load 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.