django-admin.py startproject mysite not working well on windows 7

django-admin.py startproject mysite not working well on windows 7



I'm learning django and I did successfully start a site on Windows XP by following the tutorial.



However, on Windows 7 when I issued:


django-admin.py startproject mysite



python.exe was started and a window appeared to ask me to choose either python.exe or other program to open a file....



Did I do anything wrong or there are more tricks for windows 7?




10 Answers
10



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:Python26python.exe" "%1"
change it to
"C:Python26python.exe" "%1" %*






For instance, under HKEY_CLASSES_ROOTApplicationspython.exeshellopencommand

– Everett Toews
Dec 27 '10 at 4:39






I had the same problem as the OP, this fixed it for me. Thanks.

– Kjartan Albertsson
Mar 24 '11 at 9:59






This worked for me, I had to change two register keys: HKEY_CLASSES_ROOTpy_auto_fileshellopencommand HKEY_CURRENT_USERSoftwareClassesApplicationspython.exeshellopencommand

– Sam
Jan 9 '12 at 19:22






Is there a solution for Python27? I've tried looking for this and I can't find it where you say it should be located..

– Doidgey
Apr 4 '14 at 18:44



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



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


python


django-admin.py



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


django-admin.py



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:Python27python.exe;C:Python27Scripts;C:Python27Libsite-packagesdjangobin



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



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.



I also had the same problem but don't worry its simple to solve this problem, just add "C:UsersNik'smyenvScripts" to the enviroment veriables and its done.
The address may be differnt in your pc as it depends where you install it.



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


django-admin


django-admin.py






In Django 2+ confirmed to work as well. In cmd.exe simply using 'django-admin ...' will work. pip3 install django will install a 'django-admin.exe' script in the 'Scripts' folder of your activate python environment.

– saltycraig
Mar 12 '18 at 12:50


pip3 install django



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


#!/usr/bin/env python


#!D:Program FilesPythonpython.exe


python.exe



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


python django-admin.py startproject mysite



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:Python34Scripts 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.!!!



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.


django-admin




Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



Would you like to answer one of these unanswered questions instead?

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)