How do you reload a Django model module using the interactive interpreter via “manage.py shell”?

前端 未结 9 1100
广开言路
广开言路 2020-11-28 02:14

I know how to reload a regular Python module within a regular Python interpreter session. This question documents how to do that pretty well:

How do I unload (reload

9条回答
  •  孤街浪徒
    2020-11-28 03:16

    Assuming your project is set up this way

    • project name : bookstore
    • app name : shelf
    • model name : Books

    first load

    from bookstore.shelf.models import Books
    

    subsequent reloads

    import bookstore;reload(bookstore.shelf.models);from bookstore.shelf.models import Books
    

提交回复
热议问题