TypeError:必须使用Signature实例作为第一个参数调用unbound方法check()(没有任何内容)

时间:2017-08-01 12:03:50

标签: python django

我正在将现有的Django应用程序从1.3升级到1.11,大多数工作正常,现在正试图让Celery正常工作。我得到了一些与Celery相关的未知列错误,所以我想我需要运行迁移。但是运行./manage.py检查或./manage.py makemigrations会在标题中给出错误,但我无法解决此问题。它似乎来自Django的代码,而不是我的应用程序 - 这里是完整的堆栈跟踪:

Traceback (most recent call last):
  File "./manage.py", line 7, in <module>
    execute_from_command_line(sys.argv)
  File "/var/www/caretaker/www/production/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/var/www/caretaker/www/production/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/www/caretaker/www/production/env/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/var/www/caretaker/www/production/env/lib/python2.7/site-packages/django/core/management/base.py", line 327, in execute
    self.check()
  File "/var/www/caretaker/www/production/env/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/var/www/caretaker/www/production/env/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/var/www/caretaker/www/production/env/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/var/www/caretaker/www/production/env/lib/python2.7/site-packages/django/core/checks/model_checks.py", line 30, in check_all_models
    errors.extend(model.check(**kwargs))
TypeError: unbound method check() must be called with Signature instance as first argument (got nothing instead)

我必须升级我的manage.py,它现在包含以下内容(仅运行./manage.py会显示命令列表,因此它似乎正在运行):

#!/usr/bin/env python
import os, sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings_production_ritn")
    from django.core.management import execute_from_command_line
    execute_from_command_line(sys.argv)

pip freeze:

amqp==1.4.9
amqplib==1.0.2
anyjson==0.3.3
asn1crypto==0.22.0
bcrypt==3.1.3
billiard==3.3.0.23
celery==3.1.25
cffi==1.10.0
cryptography==1.9
Django==1.11.3
django-celery==3.2.1
django-countries==4.6.1
django-debug-toolbar==1.4
django-kombu==0.9.4
django-localflavor==1.5.2
django-picklefield==1.0.0
django-signature==0.3.1
enum34==1.1.6
Fabric==1.13.2
idna==2.5
importlib==1.0.4
ipaddress==1.0.18
kombu==3.0.37
lxml==3.8.0
M2Crypto==0.26.0
MySQL-python==1.2.5
odict==1.6.2
paramiko==2.2.1
pyasn1==0.2.3
pycparser==2.18
pycrypto==2.6.1
PyNaCl==1.1.2
pyparsing==1.5.7
python-dateutil==1.5
pytz==2017.2
PyYAML==3.12
six==1.10.0
soaplib==1.0.0
sqlparse==0.2.3
typing==3.6.1
vine==1.1.4
virtualenv==15.1.0

到目前为止我已经验证的事情:

  • 我在运行命令
  • 之前激活的virtualenv下运行
  • 系统上的python版本和virtualenv都是相同的2.7.5
  • 应用程序本身似乎可以通过WSGI使用新的Django,所以我怀疑它与通过命令行运行有关

非常感谢任何帮助或指示。

1 个答案:

答案 0 :(得分:0)

听起来你的ALSA lib rawmidi_hw.c:233:(snd_rawmidi_hw_open) open /dev/snd/midiC0D0 failed: No such file or directory 模型有Shutting down Allegro due to signal #11 Segmentation fault (core dumped) 方法,与Django 1.7中引入的system check framework冲突。

#include <allegro.h> void start(); void finish(); int main(){ start(); SAMPLE *soundfile=load_sample("sound.wav"); while(!key[KEY_ESC]){ if(key[KEY_UP]){ play_sample(soundfile,255,128,1000,0); } } finish(); return 0; } END_OF_MAIN() void start(){ int depth,res; allegro_init(); depth = desktop_color_depth(); if(depth == 0) depth=32; set_color_depth(depth); res=set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640,480,0,0); if(res!=0){ allegro_message("%s\n", allegro_error); exit(-1); } install_timer(); install_keyboard(); install_mouse(); install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT,"A"); } void finish(){ clear_keybuf(); } 方法重命名为其他方法,并记住更新任何调用它的代码。

似乎Signature模型可能来自django-signature,似乎没有多年更新。您可能需要分叉包,或寻找替代方案。