Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: __init__() missing 1 required positional argument: 'on_delete' #1

Open
sergio11 opened this issue Jan 3, 2018 · 1 comment

Comments

@sergio11
Copy link

sergio11 commented Jan 3, 2018

I am very interested in seeing how this challenge works, I have tried to mount it in a Gunicorn with Python 3.5. When installing the dependencies I get the following error:

(airProfilingNetwork) BISITE@bisite ~/Projects/AirProfilingWeb: gunicorn air_profiling.wsgi
[2018-01-03 22:51:05 +0100] [13027] [INFO] Starting gunicorn 19.7.1
[2018-01-03 22:51:05 +0100] [13027] [INFO] Listening at: http://127.0.0.1:8000 (13027)
[2018-01-03 22:51:05 +0100] [13027] [INFO] Using worker: sync
[2018-01-03 22:51:05 +0100] [13034] [INFO] Booting worker with pid: 13034
[2018-01-03 22:51:06 +0100] [13034] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
    worker.init_process()
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/gunicorn/util.py", line 352, in import_app
    __import__(module)
  File "/Users/BISITE/Projects/AirProfilingWeb/air_profiling/wsgi.py", line 16, in <module>
    application = get_wsgi_application()
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/BISITE/.virtualenvs/airProfilingNetwork/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/BISITE/Projects/AirProfilingWeb/updater/models.py", line 9, in <module>
    class Pcap(models.Model):
  File "/Users/BISITE/Projects/AirProfilingWeb/updater/models.py", line 10, in Pcap
    user = models.ForeignKey('auth.User')
TypeError: __init__() missing 1 required positional argument: 'on_delete'
[2018-01-03 22:51:06 +0100] [13034] [INFO] Worker exiting (pid: 13034)
[2018-01-03 22:51:06 +0100] [13027] [INFO] Shutting down: Master
[2018-01-03 22:51:06 +0100] [13027] [INFO] Reason: Worker failed to boot.

Could you tell me what is the configuration needed to make the project work?

Thank you so much.

@salime45
Copy link
Owner

salime45 commented Jan 5, 2018

you need change the line :
user = models.ForeignKey('auth.User')
for:
user = models.ForeignKey('auth.User', on_delete=models.CASCADE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants