First time study django The framework encountered a small problem , That is, you can't create a project , After setting the correct path , Use django-admin.py xxxxx It will open directly after django-admin.py file . Let's introduce my own solution
The first is to create projects :windows After opening the command directive in the system , Enter... Under the specified path django-admin.py startproject xxx(xxx Set your own folder name ). Then it is divided into two cases :
1. If at this time cmd Remind you django-admin.py It's not an internal or external order , Nor is it an executable , That's why the path is not set , stay windows 10 Under the system , Open this PC , Right click on this computer on the right to open properties
Next, this window pops up , Click Advanced environment settings
This time, the system properties window pops up , Click environment settings
This time, the environment variables window pops up , Find... In the system variable Path Variable , Select and click edit or double-click directly .
Install your own Django In folder django-admin.py Copy the path of the file , Click the new button in the edit environment variable window , Paste a little to make sure , Finally, I made sure all the way
Django The installation path is in your python In the folder , stay Lib\site-packages Look inside .
Reopen cmd, Input django-admin.py startproject djsite
This time it's generally ready to run . Of course, it may be the same as before , After entering the command, I directly opened my python Editor , I use it pycharm, I don't know if other editors will do this . Like the picture below
I'll go to your django-admin.py file , Change how it opens , Change to use python open
Reopen cmd, Enter the command django-amdin.py startproject xxx(xxx You took it yourself ), This problem should be solved .
I hope I can help you