[Solved]-Django-admin.py startproject mysite not working well on windows 7

14👍

That’s already been reported to the django, see http://bugs.python.org/issue7936
And these’s an solution:
open regedit and find python.exe like this
“C:\Python26\python.exe” “%1”
change it to
“C:\Python26\python.exe” “%1” %*

13👍

This is what worked for me:
I already had c:\python27 and c:\python27\Scripts in PATH.

  1. Copy django-admin.py and django-admin-script.py from c:\python27\Scripts to your desired folder
  2. with cmd go to that folder and run > django-admin startproject mysite

Note that if I doesn’t type python windows just opens the django-admin.py in editor.

9👍

I had the same error when I ran django-admin.py on the command prompt. I couldn’t create a projects.

I tried to run Regedit by using Find to Search python.exe and then adding %% but it was not sufficient.
I then added the necessary Path to the System PATH as shown below.

Open:
Control Panel -> System -> Advanced -> Environment Variables -> PATH.

Add to the PATH:

C:\Python27\python.exe;C:\Python27\Scripts;C:\Python27\Lib\site-packages\django\bin

It Work! Now I can Create Django Projects and applications Using Command on Windows 7.

2👍

In latest django(1.11.7 for now) , simple django-admin would work, instead of django-admin.py .

1👍

I had the same problem i followed django-admin.py startproject mysite not working well on windows 7
and found that the python files still associated with my text editor.
Changing the necessary registry keys fix the issue.

👤steven

1👍

I also had the same problem but don’t worry its simple to solve this problem, just add “C:\Users\Nik’s\myenv\Scripts” to the enviroment veriables and its done.
The address may be differnt in your pc as it depends where you install it.

0👍

Change the first line of django-admin.py #!/usr/bin/env python to for example #!D:\Program Files\Python\python.exe (Where you install your python.exe,that’s my directory); it works.

0👍

The solution is simple in Windows:

1-Go to C: \ Python34 \ Scripts

2-Right click on django-admin.py

3-Select open with

4-Select default program

5-Select Laucher Python for Windows (Console)

6- Run the command in CMD Windows python django-admin.py startproject mysite

👤Raul M

0👍

In Windows 8.1, I faced the same problem. In my case when I tried to create my project, it would open the contents of the page in Internet Explorer window rather than creating the project folder. I became curious of what exactly was this django-manage.py. After searching, I got to django-admin.py file in the path C:\Python34\Scripts and I right clicked on it chose to open with default program of Launcher Python for Windows(Console).

Again I got back to the CMD and in my project directory I entered:
django-admin.py startproject mysite

And worked just fine.!!!

0👍

I have faced the same issue and when I ran the Python installer again and clicked on the repair option, it magically fixed everything for me. Now, I can run django-admin straight from CMD.

0👍

  1. first of all make sure that python/Scripts is in your path
  2. run “django-admin startproject mysite” instead of “django-admin.py startproject mysite”

0👍

I get the same problem for Windows 10. Here is how I resolve it:

  1. I run the terminal CMD with administrator right. How to do that ? Right click on the terminal and click on Run as administrator.
  2. I install django by doing: python -m pip install django. You can check that django is really installed by doing: python -m pip freeze. If you see django in the list, then django is installed.
  3. Finally, I create my django project by doing: django-admin startproject project-name.

NB: For step 3, you don’t need the terminal with administrator right.

Leave a comment