Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 286 Vote(s) - 3.35 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using django-admin on windows powershell

#1
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**
Reply

#2
You need to add C:\Python33\Scripts to your PATH environment variable

here's how to update your $PATH in windows:

[To see links please register here]

Reply

#3
You need up add a path variable. To permanently set PATH:

1. Right click My computer in the desktop, or "Computer" in your start menu, depending on your version of Windows and choose **Properties**.
2. Click **Advanced System Settings** on the left.
3. Click **Environmental Variables**.
4. Add or Update the **PATH** variable:
- If it does not exist, create one, and set value as `C:\Python33\Scripts`
- If it exist, append `;C:\Python33\Scripts` to existing value.
5. Restart cmd.exe. (PATH will not change for already launched cmd.exe)
Reply

#4
I am not sure if this has been resolved.

I ran to this problem too. I was not able to run "django-admin.py" from PowerShell even though I have set my path correctly. It works fine when I am using windows command prompt.

However, I managed to fix this by adding ".PY" in PATHEXT variable, see below:

".PY;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"

Now I managed to run "django-admin.py startproject mysite" successfully using PowerShell.

Cheers.

Reply

#5
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
Reply

#6
first pip3 show django

find the path
mine was like that

> `c:\users\jadem\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages`

note that the path would be the upper level of this path which in Scripts
so just change "site-packages" to "Scripts"

then go to your environment variables and add the path
mine will look like

> `c:\users\jadem\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\Scripts`
Reply

#7
I solved this problem as follows.
I deleted the Django library.
I updated the pip.
I have loaded the Django library.
I have installed Django-binary-database-files.

CODE:

1- pip uninstall django

2- python -m pip install --upgrade pip

3- pip install django

4- pip install django-binary-database-files

It is simply :)
Reply

#8
This Error Not Happens when Path not currect, In windows i Test So much things and i under stand to install the **easy_install** in [ C:\python39\Scripts\ ] and i Found out You should install Django in Scripts

[![After This My Problem Solved][1]][1]


Install PIP with this command : easy_install pip

Clean Django : pip uninstall django

install Django : pip install django

Execut django-admin.py startproject mysite

Django Project Ready


[1]:
Reply

#9
**Hey** I was **facing the same issue** and tried almost every solution here,
Kind of **noting worked**...
but I mixed and used some solutions,


----------


So here is how I did it:

first-

pip uninstall Django

then-


> run your terminal(shell or cmd) as admin,

pip install Django

then-

> Just open the terminal without admin privileges




django-admin startproject mysite


----------
**So the error was mainly due to some restrictions from the OS**
when we install Django using pip sometimes the Operating System stops pip from saving all the files correctly

> Probably you have received an error while normally installing Django
And when used admin terminal then it had no restrictions.
----
> *The solution was clearly my approach feel free to correct me*
**THANK YOU!**
Reply

#10
in CMD (Command) or Powershell run this code, it works fine:

python -m django startproject mysite
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through