Django-Tutorials icon indicating copy to clipboard operation
Django-Tutorials copied to clipboard

Facing issue in project

Open RuntimeTerror007 opened this issue 7 years ago • 2 comments
trafficstars

PS C:\Users\Dell\Django> python manage.py runserver Unhandled exception in thread started by <function check_errors..wrapper at 0x000001BD1EFD91E0> Traceback (most recent call last): File "C:\Users\Dell\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "C:\Users\Dell\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management\commands\runserver.py", line 113, in inner_run autoreload.raise_last_exception() File "C:\Users\Dell\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception raise exception[1] File "C:\Users\Dell\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\management_init.py", line 327, in execute autoreload.check_errors(django.setup)() File "C:\Users\Dell\AppData\Local\Programs\Python\Python36\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "C:\Users\Dell\AppData\Local\Programs\Python\Python36\lib\site-packages\django_init_.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Users\Dell\AppData\Local\Programs\Python\Python36\lib\site-packages\django\apps\registry.py", line 112, in populate app_config.import_models() File "C:\Users\Dell\AppData\Local\Programs\Python\Python36\lib\site-packages\django\apps\config.py", line 198, in import_models self.models_module = import_module(models_module_name) File "C:\Users\Dell\AppData\Local\Programs\Python\Python36\lib\importlib_init_.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 978, in _gcd_import File "", line 961, in _find_and_load File "", line 950, in _find_and_load_unlocked File "", line 655, in _load_unlocked File "", line 678, in exec_module File "", line 205, in _call_with_frames_removed File "C:\Users\Dell\Django\accounts\models.py", line 11, in class UserProfile(models.Model): File "C:\Users\Dell\Django\accounts\models.py", line 13, in UserProfile user = models.OneToOneField(User) TypeError: init() missing 1 required positional argument: 'on_delete'

RuntimeTerror007 avatar Feb 11 '18 08:02 RuntimeTerror007

Same here !! I am also getting the same error. @maxg203 Can u please tell what to write in the required argument 'on_delete' ??

MitaliBhurani avatar Feb 13 '18 06:02 MitaliBhurani

Try adding the parameter on_delete=models.CASCADE. That parameter has been made required in Django 2.0.

maxg203 avatar Feb 13 '18 15:02 maxg203