Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

django

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

like image 312
Suman KC Avatar asked Jan 09 '16 09:01

Suman KC


2 Answers

First step was to set the environment variable.

  • windows key + pause or Control Panel\System and Security\System
  • 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

like image 156
Suman KC Avatar answered Oct 08 '22 09:10

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.

like image 2
Stephen Medeiros Avatar answered Oct 08 '22 07:10

Stephen Medeiros