django sudo runserver启动错误

前端之家收集整理的这篇文章主要介绍了django sudo runserver启动错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我尝试运行sudo ./manage.py runserver时,我得到以下错误
Traceback (most recent call last):
  File "./manage.py",line 9,in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",line 429,in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",line 379,in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",line 252,in fetch_command
    app_name = get_commands()[subcommand]
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py",line 101,in get_commands
    apps = settings.INSTALLED_APPS
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py",line 276,in __getattr__
    self._setup()
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py",line 42,in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py",line 139,in __init__
    logging_config_func(self.LOGGING)
  File "/usr/lib/python2.7/logging/config.py",line 776,in dictConfig
    dictConfigClass(config).configure()
  File "/usr/lib/python2.7/logging/config.py",line 562,in configure
    'filter %r: %s' % (name,e))
ValueError: Unable to configure filter 'require_debug_false': Cannot resolve 'django.utils.log.requiredebugFalse': No module named requiredebugFalse

运行./manage.py runserver工作得很好.

做一点挖掘,我发现这可能与Django1.3错误有关?但是,我正在运行Django 1.4 pre-alpha的virtualenv.

我需要sudo命令的原因是因为我正在尝试从80端口运行服务器,这需要sudo.

解决方法

当您使用sudo运行manage.py时,它不会使用激活的虚拟环境.最有可能的是,在virtualenv之外安装了另外一个django版本.

您可以使用virtualenv中的python可执行文件运行,即:

$sudo /home/USER/.virtualenvs/YOUR_PROJECT/bin/python manage.py runserver

你可以从virtualenv获取python可执行路径:

$which python
原文链接:/python/185629.html

猜你在找的Python相关文章