Django python has stopped working when trying to r

2019-07-21 16:45发布

问题:

python manage.py runserver

works fine the first time, but after closing it with ctrl+c, I can't start it up again. I get the error message "Python has stopped working".

This is easily fixed by restarting my computer but it is very inconvenient.

I have also tried the same thing using pycharm, but i get the error message:

Process finished with exit code -1073741819 (0xC0000005)

I am currently on Windows 10.

回答1:

This happens to me and I'm not using Pycharm. I'm using Powershell, Python 3.6 and Django 1.10

If you do

python manage.py runserver --noreload

then it works.

This was reported but as it's not clear if it's related to Powershell or Django, the report is not allowed to be open. https://code.djangoproject.com/ticket/27766



回答2:

First step was to set the environment variable.

  1. windows key + pause or Control Panel\System and Security\System
  2. Advance system settings (this will open system property)
  3. navigate to Advanced tab > Environment variable
  4. Edit path - append c:\python36 in variable value field
  5. Change 'c:\python36' to ';c:\python36'

then /python manage.py runserver should work

I have no idea why but it worked for me.