我已经从django 1.2.7升级到django 1.5.1
我正在使用python 2.6.6
当我尝试运行时python manage.py collectstatic我得到
未知命令:'collectstatic'
来自我的settings.py
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.staticfiles',
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.contrib.messages.context_processors.messages",
"MYPROJECT.control.context_processors.debug",
"django.core.context_processors.static",
)
Run Code Online (Sandbox Code Playgroud)
如果我跑python manage.py help 我得到
Available subcommands:
[django]
cleanup
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
runfcgi
runserver
shell
sql
sqlall
sqlclear
sqlcustom
sqlflush
sqlindexes
sqlinitialdata
sqlsequencereset
startapp
startproject
syncdb
test
testserver
validate
Run Code Online (Sandbox Code Playgroud)
如果我跑 python manage.py …
我写了一个简单的自定义命令hello.py:
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "prints hello world"
def handle_noargs(self, **options):
print "Hello, World!"
Run Code Online (Sandbox Code Playgroud)
当我运行python manage.py hello时它返回
未知命令:'你好'
运行python manage.py syncdb等没问题.如果我在命令行输入python,我可以导入django.core.management ok.
我知道我错过了一些明显的东西,但无法弄清楚是什么.
我该怎么调试这个来解决为什么我的自定义命令不能运行?