0

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?

5
  • You might want to refer to this link here Commented Jul 23, 2018 at 12:09
  • Can you once try in Powershell or command prompt Commented Jul 23, 2018 at 12:09
  • When I tried in powershell, it returns SyntaxError: Generator expression must be parenthesized Commented Jul 24, 2018 at 5:58
  • Did you find a solution, I am having simialr issue Commented Nov 11, 2018 at 9:15
  • possible duplicate of: stackoverflow.com/questions/32597209/… Commented Nov 20, 2019 at 22:48

4 Answers 4

1

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
Sign up to request clarification or add additional context in comments.

5 Comments

I tried with that command but it now returns SyntaxError instead of the cursor blinking.
Ah actually had same issue 3 year ago and I tried like this. But instead of gitbash try powershell then.
Tried with both command prompt & powershell but it returns the same SyntaxError too.
This is the ending part of the error from django.contrib.admin.filters import ( File "D:\kz\python\python-tdd-book\virtualenv\lib\site-packages\django\contrib\admin\widgets.py", line 152 '%s=%s' % (k, v) for k, v in params.items(), SyntaxError: Generator expression must be parenthesized
This answer says there's a problem between Django and python 3.7. So I ended up installing python 3.6 and things are working as expected after that.
0

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

1 Comment

Trying in command prompt also returns SyntaxError: Generator expression must be parenthesized
0

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.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.