Is there a way to autoload models in the pycharm django console (in a similar way to how django-extensions shell_plus works)?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Django __str__ returned non-string (type NoneType)
- Evil ctypes hack in python
In pycharm setting, django console settings you can have a starting script:
This will automatically load the django models, like shell_plus:
To extend Yunti's answer, if you want the models to be namespaced inside a 'models' module, you can create a module on-the-fly in the run script and add all models to it:
To go even further, if you're working on a specific django app and want external models to be in a separate namespace than the models of your app, you can extend this even further:
Now, all your models are available under your_models. and all external models (like AccessToken, Group, &c.) are available under ext_models.