django-admin.py startproject is not working
For anyone stumbling across this now, this problem is a result of Windows not obeying the #!C:\Path\To\Virtualenv\Scripts\Python.exe hashbang at the top of django-admin.py, and therefore running it with the wrong python.exe (evidently a virtualenv bug).
However, with virtualenv active, you can use the following command, which will result in the correct python being used, and everything being ok:
python C:\Path\To\Virtualenv\Scripts\django-admin.py startproject <project_name>
If you are running Windows for a quick fix you can create a batch file with the following values:
@echo off
@echo "Enter Proyect name"
set /p proj_name=
set building="Building django project %proj_name%"
@echo %building%
python c:/Python27/Scripts/django-admin.py startproject %proj_name%
pause
I named the file "django.bat" and to use it you can just simply add a copy in the directory you want to start the project, execute the file and it will ask you for a project name, provide one and then Voila!!
Hope this helps.
Do you have a DJANGO_SETTINGS_MODULE
environment variable set (presumably from the mysite
project)? If so, django thinks you're working on the old project and doesn't give you the startproject
option. Try unsetting the environment variable and trying again.
For me worked without .py
extension, since there was .exe
by that name in my windows:
C:\Python27\Scripts\django-admin startproject HelloWorld