2

It worked when I did the poll tutorial in linux, but I'm doing it again in Windows 7, and it does nothing.

I already set the environmental variables, and set the file association to my python27.exe

When I run django-admin.py startproject mysite from the DOS command prompt, it executes, but it's showing me all the information (Like the options, etc) as though I typed the help option instead. It's not actually creating project files in my directory. I appreciate the help.

also, I tried the solution found here (it appears to be the exact same problem). It did not work

django-admin.py is not working properly

Community
  • 1
  • 1
tim tran
  • 705
  • 2
  • 11
  • 18

6 Answers6

2

I ran into the same problem.

Never having worked with Django before but having worked with Python 2.7 a fair bit, all on a windows 7 platform. I downloaded the latest version of Django and unpacked it on my desktop.

After mucking around a bit managed to get it to install itself. I found could not just follow the tutorial thats provided in the docs googled the problem and found this thread, now I was able to get it to work by doing the following things,

I work with a dos command window open. I navigate to the root of where I want the project file to be set up. I then ensure that the django_admin file has been editted as per wynston's instructions and then typed the following.

python c:\location of django_admin.py startproject projectname

and it executed beautifully.

*Thanks to wynston for the edit to the django_admin.py file.

1

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.

iMom0
  • 12,493
  • 3
  • 49
  • 61
wynston
  • 11
  • 1
1

Try to run python27 django-admin.py startproject mysite from the command line,maybe a different (older) python.exe executes the django-admin.py file. If there's a program associated to the .py files, things mixes up, and your path environment variable doesn't matter.

I suggest you to use virtualenv. When you use it, you should put the python.exe before every .py file you want to run, because the install of python will associate .py files to the installed python.exe, and will use that, whatever is in your path. :(

balazs
  • 5,698
  • 7
  • 37
  • 45
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
  • 1
  • 2
0

Great answers. But unfortunately it did not work for me. This is how I solved it

  1. Opened django_admin.py as @wynston said. But the path at first line was already showing #!C:\ correctly. So did not had to change it

  2. I had to put "..." around django-admin.py address. Navigated to the project directory in cmd.exe and ran this

    python "C:\Users\ ......\Scripts\django-admin.py" startproject projectname

It worked only with the quotation marks. I am using Anaconda Python 2.7 64 bit, on Windows 7, 64 bit. Hope it helps

Asif Rehan
  • 983
  • 2
  • 8
  • 25
0

Use python django-admin.py startproject mysite. That worked for me some time ago when I had the same issue.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636