我試圖在django中創建超級用戶,但不斷收到此錯誤消息。無法在Django中創建超級用戶,Virtualenv
Superuser creation skipped due to not running in a TTY. You can run `manage.py createsuperuser` in your project to create one manually.
我第一次嘗試日食自定義命令,比我看到一些人能夠使用隨的virtualenv窗口的命令行超級用戶,所以我安裝並激活它。但是直到現在我還是無法創建超級用戶。我一直在CMD打字的是
C:\Users\name>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python manage.py createsuperuser
File "<stdin>", line 1
python manage.py createsuperuser
^
SyntaxError: invalid syntax
我也試過了。
C:\Users\name>python manage.py createsuperuser
python: can't open file 'manage.py': [Errno 2] No such file or directory
您需要在正確的目錄中運行命令.. – Sayse
該命令應該在Python外部運行:'$ python manage.py createsuperuser' –