0

I just installed Django yesterday and went through part 1 and 2 of the tutorial no problems. Things were fuzzy so I wanted to start again. Between last night and now, only difference is I got Windows 10.

I type into command: django-admin startproject mysite2

It shows no errors, but it does not pop mysite2 or anything into the directory I am in. After searching an hour or so, I find a solution in django-admin.py startproject is not working

If I type into cmd: python C:\Python27\Scripts\django-admin.py startproject , it works. However, it's going to get a bit tedious and I can't help but think this problem is going to extend further down the line too. What is the reason why I can only start the project this way, and is there a way I can permanently change it?

Community
  • 1
  • 1
Kyle Truong
  • 2,545
  • 8
  • 34
  • 50

2 Answers2

1

It sounds like when you upgraded, the PATH environment variable was modified. If that's the case, here's how you can fix it.

Why can I only start the project this way?

When the operating system sees the django-admin command, it does not know what that means. It checks the PATH variable (which holds a list of directories as a single string). The OS will then check each of these directories for a program named django-admin. It appears that during the course of the upgrade the path variable was modified and now no longer includes C:\Python27\Scripts.

Is there a way to permanently change it?

Yes. You'll just need the add C:\Python27\Scripts to your PATH. This page explains how to update PATH for Windows 8 (though at the top it also says it is applicable to Windows 10). Specifically:

Windows 8

1) Drag the Mouse pointer to the Right bottom corner of the screen

2) Click on the Search icon and type: Control Panel

3) Click on -> Control Panel -> System -> Advanced

4) Click on Environment Variables, under System Variables, find PATH, and click on it.

5) In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.

6) Close the window.

chucksmash
  • 5,777
  • 1
  • 32
  • 41
0

I can suggest you reinstall python and django.

Camilo Torres
  • 478
  • 2
  • 8