11 Replies - 2215 Views - Last Post: 04 October 2012 - 04:00 PM Rate Topic: -----

#1 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2860
  • View blog
  • Posts: 10,964
  • Joined: 15-July 08

Django-Admin issues (woes)

Posted 02 October 2012 - 10:58 PM

Hey guys.

I'm back again with more Django woes. I tried solving this a while back with with you all with no solution yet, and as far as my research goes, there are a few people who have the same issue as I am. I have to use Django 1.1 for compatability reasons and I'm on a Windows machine.

My issue is that no matter what settings I tweak, I simply cannot access the django-admin.py file. I have correctly set the PYTHONPATH, the PATH, and the sys.path variables to include C:\Python27\Scripts, where this file is located, and the following commands yield the following results:

C:\Users\Stephen>C:\Python27\Scripts\django-admin.py startproject mynewproject1
Type 'django-admin.py help' for usage.

C:\Users\Stephen>django-admin.py startproject mynewproject1
Type 'django-admin.py help' for usage.

C:\Users\Stephen>django-admin.py help
Type 'django-admin.py help' for usage.

C:\Users\Stephen>python django-admin.py startproject mynewproject1
python: can't open file 'django-admin.py': [Errno 2] No such file or directory



The ONLY command that works is this:
C:\Users\Stephen>python C:\Python27\Scripts\django-admin.py startproject mynewpr
oject



Which is clearly a pain in the butt to write. According to the python docs and every stackoverflow topic that I have read, this problem simply does not exist....but I ask you guys ---- what's wrong?

Thanks,
- Dog

Is This A Good Question/Topic? 0
  • +

Replies To: Django-Admin issues (woes)

#2 RedRabbit  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 71
  • Joined: 09-May 10

Re: Django-Admin issues (woes)

Posted 03 October 2012 - 03:38 AM

Did you install django properly....why don't you try removing it completely and start over:

do a cd to the location of django

then python setup.py install

I remember installing it on windows it was such a pain, I did get it working but ended up installing fedora onto a partition because almost all exmaples deal with a mac or linux box.

It just makes life easier

This post has been edited by RedRabbit: 03 October 2012 - 03:40 AM

Was This Post Helpful? 0
  • +
  • -

#3 RedRabbit  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 71
  • Joined: 09-May 10

Re: Django-Admin issues (woes)

Posted 03 October 2012 - 03:44 AM

This is a solution I found from Stackoverflow from guys having your same problem:

Find a .py file (any, even a blank).
Right click on it and choose: "Open with>" and then select "Choose program...".
This pops up a list of all programs - select python, and check the box "Always use the selected program to open this kind of file" and then click OK.

Checking this box resets file associations and fixes this problem for command line.

Cause of the problem - Telling windows to open up .py files in a text editor as default.
Was This Post Helpful? 0
  • +
  • -

#4 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2860
  • View blog
  • Posts: 10,964
  • Joined: 15-July 08

Re: Django-Admin issues (woes)

Posted 03 October 2012 - 06:34 AM

View PostRedRabbit, on 03 October 2012 - 06:38 AM, said:

then python setup.py install


I have done this several times now. It has successfully installed (as in, I can access the django libraries from within python just great)

View PostRedRabbit, on 03 October 2012 - 06:44 AM, said:

This is a solution I found from Stackoverflow from guys having your same problem:

Find a .py file (any, even a blank).
Right click on it and choose: "Open with>" and then select "Choose program...".
This pops up a list of all programs - select python, and check the box "Always use the selected program to open this kind of file" and then click OK.

Checking this box resets file associations and fixes this problem for command line.

Cause of the problem - Telling windows to open up .py files in a text editor as default.


I have already done this. I have the opening program set for:
"C:\python27\python.exe" "%1" %*

But the problem still exists.
Was This Post Helpful? 0
  • +
  • -

#5 RedRabbit  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 71
  • Joined: 09-May 10

Re: Django-Admin issues (woes)

Posted 03 October 2012 - 01:34 PM

Dogstopper have you tried right clicking on command prompt and selecting Run as Administrator?

This little step can sometimes cause a really big headache!
Was This Post Helpful? 0
  • +
  • -

#6 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2860
  • View blog
  • Posts: 10,964
  • Joined: 15-July 08

Re: Django-Admin issues (woes)

Posted 03 October 2012 - 03:09 PM

I still get the same errors under an administrative CMD prompt.
C:\Users\Stephen>django-admin.py startproject newproject
Type 'django-admin.py help' for usage.

C:\Users\Stephen>django-admin.py help
Type 'django-admin.py help' for usage.


Was This Post Helpful? 0
  • +
  • -

#7 RedRabbit  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 71
  • Joined: 09-May 10

Re: Django-Admin issues (woes)

Posted 04 October 2012 - 01:40 PM

Im out of ideas really, anyone else wanna pitch in??

Let me try installing it on my machine and I will get back to you with the results its Django 1.1 on windows 7 right?
Was This Post Helpful? 1
  • +
  • -

#8 RedRabbit  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 71
  • Joined: 09-May 10

Re: Django-Admin issues (woes)

Posted 04 October 2012 - 01:54 PM

Ok I just did the install and it works no problems, looking at your structure are you sure you are in the right directory?

I installed Django on my C: drive in a folder called Django

so in command prompt:

C:\Users\AQ>CD C:\Django\django\bin

C:\Django\django\bin>django-admin.py startproject projName


And it worked maybe you aren't in the right directory so just substitute the above with where you installed your copy of Django and it should work. Let me know if this was the issue, it looks like it is from what you posted above.

This post has been edited by RedRabbit: 04 October 2012 - 01:56 PM

Was This Post Helpful? 1
  • +
  • -

#9 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2860
  • View blog
  • Posts: 10,964
  • Joined: 15-July 08

Re: Django-Admin issues (woes)

Posted 04 October 2012 - 02:02 PM

Yes, that works, but in general, I want to start a project in the current directory, not in the root django and I'm lazy. Thanks for the help. I'm writing a program (in python) to do these things.
Was This Post Helpful? 0
  • +
  • -

#10 Dogstopper  Icon User is offline

  • The Ninjaducky
  • member icon



Reputation: 2860
  • View blog
  • Posts: 10,964
  • Joined: 15-July 08

Re: Django-Admin issues (woes)

Posted 04 October 2012 - 02:44 PM

Aha...I found it. Seeting the Python.File type did not work at all.

I had to go through the the registry and look for all the python key and change them appropriately to:
"C:\python27\python.exe" "%1" %*



It seems that there are many more than 1 instance of this command in the registry, and changing all of them is needed.

Thank you so much for the help!
Was This Post Helpful? 0
  • +
  • -

#11 RedRabbit  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 71
  • Joined: 09-May 10

Re: Django-Admin issues (woes)

Posted 04 October 2012 - 02:48 PM

To add a project in the python path use the following command:

C:\Django\django\bin>django-admin.py startproject --pythonpath="C:\the\path\wanted\" projectName


It says it adds it to the project path however it still gets created in the root folder!!!

Good luck with the project
Was This Post Helpful? 0
  • +
  • -

#12 RedRabbit  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 71
  • Joined: 09-May 10

Re: Django-Admin issues (woes)

Posted 04 October 2012 - 04:00 PM

Hey no probs glad you found the solution you were looking for :bigsmile:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1