[Django]-Make Django not lazy-load module, for development convenience

0πŸ‘

βœ…

I ended up just adding a section like this to my manage.py, right before the execute_from_command_line line:

argv_string = ' '.join(sys.argv)
if ('gunicorn' in argv_string) or ('runserver' in argv_string):
    import all_my_stuff
πŸ‘€Ram Rachum

0πŸ‘

It looks like this library: https://github.com/ojii/django-load, which is fairly simple, has a function to load a module from within Django. If you combine that technique with a Django entry point hook (like http://eldarion.com/blog/2013/02/14/entry-point-hook-django-projects/), you should be able to explicitly load your modules at startup. (I did not try it myself, but it looks feasible.)

πŸ‘€kag

Leave a comment