Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using django-admin on windows powershell

In the Django tutorial for starting a new project, the command to run is

django-admin.py startproject mysite

However, when I run this, I always encounter the following error:

django-admin : The term 'django-admin' is not recognized as the name of a cmdlet, 
function, script file, or operable
program. Check the spelling of the name, or if a path was included, 
verify that the path is correct and try again.

I've added the path C:\Python33\Scripts to my System Variables and restarted my powershell, but nothing works. I've figured out that the workaround is to instead execute the following:

py C:\Python33\Scripts\django-admin.py startproject mysite

Is there any way to fix this problem to where I just need to call django-admin.py instead of specifying the directory?

Clarification: This error is with Windows Powershell. Windows Command Prompt works fine but I was wondering what was causing this difference

like image 303
Michael Liu Avatar asked May 03 '14 01:05

Michael Liu


People also ask

How do I run Django as administrator in Windows?

Django can be installed easily using pip . In the command prompt, execute the following command: pip install django . This will download and install Django. After the installation has completed, you can verify your Django installation by executing django-admin --version in the command prompt.

Why Django admin is not working?

Problems running django-admin django-admin should be on your system path if you installed Django via pip . If it's not in your path, ensure you have your virtual environment activated and you can try running the equivalent command python -m django .

How do you fix it Django admin is not recognized as an internal or external command operable program or batch file?

'django-admin' is not recognized as an internal or external command, operable program or batch file. To fix this, first close the terminal window and relaunch it with administrator privileges. Once you launch the elevated terminal window change directory to where you wish to start your Django project.


2 Answers

in CMD (Command) run this code, it works fine:

python -m django startproject mysite
like image 185
Wria Mohammed Avatar answered Sep 17 '22 21:09

Wria Mohammed


binary file is missing from the specified folder. You need to install binary file. You can use following command to solve the problem. go to required directory:

In your case it is:

C:\Python33\Scripts\pip install django-binary-database-files

Hope it will help to solve the issue

like image 37
saurav suman Avatar answered Sep 18 '22 21:09

saurav suman