Django /manage.py runserver doesn't work (Windows)

Question:

I have installed python 2.7.10 in windows. I installed django in path c:python27/scripts/with a command pip install django and created project with command django-admin startproject mysite from the same path.

Now to run server i cd to path c:python27/scripts/mysite and ran a command manage.py runserver/ manage.py runserver 0.0.0.0:8000 And this has no any effect.

where did i go wrong, and also i couldn’t run with python console. and i couldn’t redirect to my project from python CMD. all i did is from windows console.

Edit:
Screenshot of execution
enter image description here

Asked By: Suman KC

||

Answers:

First step was to set the environment variable.

  • windows key + pause or Control PanelSystem and SecuritySystem
  • Advance system settings (this will open system property)
  • navigate to Advanced tab > Environment variable
  • Edit path – append ;c:python27 in variable value field
  • Restart CMD

then /python manage.py runserver should work

Answered By: Suman KC

Trying setting up a virtualenv for your project.

This same issue happened to me when trying to launch the test server

python .manage.py runserver

from PowerShell on Windows 10. According to the Django site, there might be an issue with the type of arguments being passed from PowerShell.

My workaround was to use a virtualenv. Once that was setup with django installed via pip, the runserver command worked.

Answered By: Stephen Medeiros

After setting C:Python in the environment variables, issuing the following command helped:

py manage.py runserver
Answered By: Peter

had the same problem. fixed it by checking python and django version compatibility. If you’re still battling with this update one or the other or ensure they’re both compatible with each other in the virtual’env’ you’re setting up.

good luck.

Answered By: benefeela

Try this fix guys:
1. Right click on the windows icon/start on the bottom left and run Windows Powershell as admin.
2. Than type cd ~/ and later change the path again to the project folder.
3. type python manage.py runserver and press enter.

Answered By: AndroidDev Newbie

The best solution is to install Python from Microsoft Store. In this case, you won’t have to worry about the Environmental Variables and Path. Windows will detect all that automatically.

Answered By: Shadab Hashmi

I think you forgot to add python to environment variables. So, During the installation, click the checkbox named "Add Python 3.9 to PATH" to add in environment variables. or you can simply add the path later.
enter image description here

Answered By: Yumick Gharti

When you open the command prompt on windows, the default directory might be C:WINDOWSSystem32>
Here, you have to change the directory by just adding cd to the default directory. Then copy the directory of where your project is and paste with one space. So it will be:
C:yourfolderyourproject>
Next, use the comman which is, python manage.py runserver

That’s all

Answered By: Mac Joe
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.