Reputation: 3528
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.
Upvotes: 8
Views: 37856
Reputation: 21
When you open the command prompt on windows, the default directory might be C:\WINDOWS\System32> 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:\yourfolder\yourproject> Next, use the comman which is, python manage.py runserver
That's all 😅
Upvotes: 0
Reputation: 1196
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.
Upvotes: 0
Reputation: 387
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.
Upvotes: 2
Reputation: 21
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.
Upvotes: 1
Reputation: 11
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.
Upvotes: 0
Reputation: 19
After setting C:\Python
in the environment variables, issuing the following command helped:
py manage.py runserver
Upvotes: -1
Reputation: 21
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.
Upvotes: 2
Reputation: 3528
First step was to set the environment variable.
windows key
+ pause
or Control Panel\System and Security\System
Advanced tab
> Environment variable
;c:\python27
in variable value fieldthen /python manage.py runserver
should work
Upvotes: 7