Skip to main content
 首页 » 编程设计

python之Django:ValueError:当前限制超过最大限制

2025年05月04日52jirigala

我在我的 Django 应用程序中收到 ValueError: current limit exceeds maximum limit。如果我从安装的应用程序中删除 haystack,它就会消失。我尝试过升级 haystack、降级 haystack、删除与 haystack 相关的所有代码,但这仍然是一个问题。

完整回溯:

File "./manage.py", line 10, in <module> 
    execute_from_command_line(sys.argv) 
  File "/Users/user/pyProjects/projects/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line 
    utility.execute() 
  File "/Users/user/pyProjects/projects/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute 
    django.setup() 
  File "/Users/user/pyProjects/projects/env/lib/python2.7/site-packages/django/__init__.py", line 18, in setup 
    apps.populate(settings.INSTALLED_APPS) 
  File "/Users/user/pyProjects/projects/env/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate 
    app_config = AppConfig.create(entry) 
  File "/Users/user/pyProjects/projects/env/lib/python2.7/site-packages/django/apps/config.py", line 86, in create 
    module = import_module(entry) 
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module 
    __import__(name) 
  File "/Users/user/pyProjects/projects/env/lib/python2.7/site-packages/haystack/__init__.py", line 56, in <module> 
    maxnofile[1])) 
ValueError: current limit exceeds maximum limit 

已安装的应用:

INSTALLED_APPS = ( 
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'django.contrib.sites', 
 
    # 3rd Party Modules 
    'corsheaders', 
    'crispy_forms', 
    'rest_framework', 
    'wkhtmltopdf', 
    'autocomplete_light', 
    'whoosh', 
    'haystack', 
    'threadedcomments', 
    'django_comments', 
    'pytz', 
) 

请您参考如下方法:

我相信你做到了

pip install haystack

但是,你应该使用 django-haystack,所以这样做

pip 卸载 haysatck

pip 安装 django-haystack