gcloud应用程序部署-TypeError:__init __()缺少1个必需的位置参数:'on_delete'

时间:2018-08-07 00:26:14

标签: django gcloud

这是我第一次在Google Cloud中部署我的应用。当我输入'gcloud app deploy'命令时,它由于TypeError: __init__() missing 1 required positional argument: 'on_delete'而失败。但这似乎不是我的编码问题,而是Django本身。请给我任何帮助我理解此错误消息的评论。

Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Application startup
error: [2018-08-06 23:53:20 +0000] [1] [INFO] Starting gunicorn 19.9.0
[2018-08-06 23:53:20 +0000] [1] [INFO] Listening at:
http://0.0.0.0:8080 (1) [2018-08-06 23:53:20 +0000] [1] [INFO] Using
worker: sync [2018-08-06 23:53:20 +0000] [7] [INFO] Booting worker
with pid: 7 [2018-08-06 23:53:20 +0000] [7] [ERROR] Exception in
worker process Traceback (most recent call last):   File
"/env/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in
spawn_worker
    worker.init_process()   File "/env/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129,
in init_process
    self.load_wsgi()   File "/env/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138,
in load_wsgi
    self.wsgi = self.app.wsgi()   File "/env/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in
wsgi
    self.callable = self.load()   File "/env/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52,
in load
    return self.load_wsgiapp()   File "/env/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41,
in load_wsgiapp
    return util.import_app(self.app_uri)   File "/env/lib/python3.6/site-packages/gunicorn/util.py", line 350, in
import_app
    __import__(module)   File "/home/vmagent/app/acct/wsgi.py", line 16, in <module>
    application = get_wsgi_application()   File "/env/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in
get_wsgi_application
    django.setup(set_prefix=False)   File "/env/lib/python3.6/site-packages/django/__init__.py", line 24, in
setup
    apps.populate(settings.INSTALLED_APPS)   File "/env/lib/python3.6/site-packages/django/apps/registry.py", line 112,
in populate
    app_config.import_models()   File "/env/lib/python3.6/site-packages/django/apps/config.py", line 198, in
import_models
    self.models_module = import_module(models_module_name)   File "/env/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)   File "/env/lib/python3.6/site-packages/data_wizard/models.py", line 15, in
<module>
    class Run(models.Model):   File "/env/lib/python3.6/site-packages/data_wizard/models.py", line 16, in
Run
    user = models.ForeignKey(settings.AUTH_USER_MODEL) TypeError: __init__() missing 1 required positional argument: 'on_delete' [2018-08-06 23:53:20 +0000] [7] [INFO] Worker exiting (pid: 7)
[2018-08-06 23:53:20 +0000] [1] [INFO] Shutting down: Master
[2018-08-06 23:53:20 +0000] [1] [INFO] Reason: Worker failed to boot.

1 个答案:

答案 0 :(得分:1)

看起来像django-data-wizard的问题。对于on_delete字段,必须从Django 2.0 ForeignKey参数开始,显然数据向导库未传递该参数:

https://docs.djangoproject.com/en/2.0/releases/2.0/#features-removed-in-2-0

  

在模型和迁移中,现在需要ForeignKey和OneToOneField的on_delete参数。

检查您的数据向导版本是否支持Django 2.x,或者在不需要时删除依赖项。