Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Django - Have to restart Pythonista everytime I make a code change
-
Hi,
As the title suggests, everytime I make a change to my Django code I'm finding that hitting ctrl-c in the console to kill the server isn't enough.
I am running manage.py with the --noreload option.
I am having to kill Pythonista all together and then reload it for my changes to seem to take affect.
Has anyone experienced this or got any idea's on how to fix this issue?
Thank you in advance.
-
Hi,
just a thought: Have you tried „reset environment“ by holding clear button in console?
Regards
Tom -
-
Thanks guys,
The 'reset environment' option didn't work and the other link was just talking about getting Django to start.
I think I got it working by using the 'reset.py' script provided here
https://forum.omz-software.com/topic/3242/my-experience-with-django
-
Hey there!
I too was having this same problem, other scripts and reset routines weren't doing the job for me.
But i threw this together and it works quite well for me, near the top of the manage.py
# unload django modules to release cached files. Server reload will reflect changes in code without full Pythonista restart if settings.DEBUG: names = [name for name in sys.modules.keys() if name.startswith('django.')] for name in names: del sys.modules[name] print(f'Unloaded {len(names)} django modules.')
Hope this helps!
- Benjamin