khunzohn
khunzohn

Reputation: 11

Running Django development server from Git Bash gets stuck in windows 10

I'm new to Django and now getting stuck in running up the server. I've installed the following components on Windows 10:

Python 3.7.0
Django 1.11.14
Geckodriver 0.21.0

I can successfully create a project using django-admin.py startproject {project_name} .
but when I run python manage.py runserver, the Git Bash doesn't seem to make any progress and the process gets stuck there forever.

$ python manage.py runserver
|

I'm supposed to get something like the following output though,

Performing system checks...

System check identified no issues (0 silenced).

Django version 1.8.3, using settings 'projectname.settings' Starting >development server at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK.

I've also activated the virtualenv too. What could be the cause of this problem?

Upvotes: 0

Views: 2657

Answers (4)

azalea
azalea

Reputation: 12640

It works by

winpty python manage.py runserver

You can add an alias to your .bashrc by

echo "alias python='winpty python.exe'" >> ~/.bashrc

More info here

Upvotes: 0

Charley Erd
Charley Erd

Reputation: 103

Quite literally exit bash, reopen bash, and run your server it will no longer hang. I had the same issue anytime I made changes to my server database configuration(make/run migrations). I can't root cause it, it may be a linux running inside windows thing, but I'm not sure.

Upvotes: 0

Osman Goni Nahid
Osman Goni Nahid

Reputation: 1279

Thing is when you run python manage.py runserver by default it will run with auto reload.

Means when you change any file it will re-run or relaod again where it might be needed to kill and start port e.g 8080.

Unfortunately GitBash is more lighter one which is not capable to kill process.Have one workaround to run with not auto reload. like below:

python manage.py runserver --noreload

Upvotes: 1

Lawal Rahman Abimbola
Lawal Rahman Abimbola

Reputation: 61

I also think you should try using the windows command prompt instead

Upvotes: 0

Related Questions