[Django]-Using django-admin on windows powershell

44👍

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

python -m django startproject mysite

16👍

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

    7👍

    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)

      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

        3👍

        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!

          2👍

          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 🙂

            1👍

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

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

            http://www.computerhope.com/issues/ch000549.htm

              1👍

              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.

                1👍

                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

                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

                  0👍

                  Use the below command instead of your command:-

                  python -m django startproject app-name
                  

                    0👍

                    pip, django, and/or django-admin are not in the PATH.

                    Either:

                    1. Set the path to include \Scripts.
                    2. Use a venv (which sets the scripts folder as part of the PATH in the venv)
                    3. Start whichever module you’re trying to use with python/python3, e.g. python3 -m pip install ....

                    Which of these options you choose depends on your usage of Python.

                    1. If you use it all the time and only use one version of python and one group of modules, set the $PATH for your installation of python.
                    2. If you use Python daily with multiple versions and/or differing sets of modules, use conda venvs.
                    3. If you rarely use python, or want to try the solution without modifying your system, call your python project using python/python3 and the module switch (-m).

                      0👍

                      This problem is not related with django.This problem is related with command prompt.

                      first step: check your terminal if it is Powershell then change it to command prompt.

                      second step: download django using command pip install django.

                      third step: now type the start ptoject command ie django-admin startproject mysite and hit the enter button.

                      your project folder is now created.

                        0👍

                        Install Python 64-bit and follow this:

                        1- pip uninstall django

                        2- python -m pip install –upgrade pip

                        3- pip install django

                        4- pip install django-binary-database-files

                          -1👍

                          After trying all of these solution, none worked for me on Windows 10. So I decide to follow Django’s docs on how to fix it using ‘venv‘.

                          First add these to your PATH on Win 7:

                          C:\CondaApps\

                          C:\CondaApps\Scripts

                          C:\CondaApps\Library\bin

                          DO NOT DOWNLOAD MICROSOFT STORE PYTHON!! IT MESSES WITH CONDA PYTHON!

                          (optional) Now uninstall Django: "python uninstall Django" then:

                          a) python -m venv myDjangoEnv2

                          b) cd into \Scripts

                          c) Run ‘activate’ command in command prompt

                          d) python -m pip install Django

                          e) django-admin –version

                          f) In another command prompt or terminal, cd back to your project folder (i.e. where the "manage.py " would be if you
                          already created a project)

                          g) python manage.py runserver

                          🙂

                            -1👍

                            When I tried to uninstall Django, got the below message

                            (env) PS C:\Users\Windows 11\Documents\Python\env> pip uninstall django

                            WARNING: Skipping django as it is not installed.

                            So, went ahead and installed Django using below command
                            (env) PS C:\Users\Windows 11\Documents\Python\env> pip install django

                            Then, the django-admin utility worked for me.

                            (env) PS C:\Users\Windows 11\Documents\Python\env> django-admin startproject demoproject

                            This command was successful after that.

                              -1👍

                              Probably not the best way to do it, but it worked for me:
                              1.

                              pip uninstall django
                              
                              pip install Django
                              

                              You should see this error in your terminal:

                              WARNING: The script django-admin.exe is installed in 'C:\Users\elio\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
                                Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
                              

                              Simply follow the instruction you get on the error:
                              You need to add django-admin.exe to your PATH, to do this you need to change the environment variable.
                              3. Open your settings, and search for ‘environment variable’ to open the ‘system properties’ window (in win10, it somehow won’t find it if you type ‘system properties’)
                              4. Open the ‘environment variable’
                              5. Find a User variable named ‘Path’ and click on ‘edit’
                              6. Copy and paste the message you got in the error before with a semi-colon before, it should look something like this:

                              ;C:\Users\elio\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts
                              
                              👤Elio

                                Leave a comment