Django3 runserver error

207 views
Skip to first unread message

Mira

unread,
Jul 30, 2020, 5:25:26ā€ÆAM7/30/20
to django...@googlegroups.com
Hi All,
I recently upgraded Django from 2.2 to 3 on my MacOS10.13.
I am using Python 3.6 and My Application was working fine with Django 2.2 but now i am getting below error.

Any help related with this topic would be greatly appreciated.

$>python3 manage.py runserver

Watching for file changes with StatReloader

Performing system checks...


Traceback (most recent call last):

Ā  File "manage.py", line 22, in <module>

Ā  Ā  execute_from_command_line(sys.argv)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line

Ā  Ā  utility.execute()

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute

Ā  Ā  self.fetch_command(subcommand).run_from_argv(self.argv)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv

Ā  Ā  self.execute(*args, **cmd_options)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 60, in execute

Ā  Ā  super().execute(*args, **options)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute

Ā  Ā  output = self.handle(*args, **options)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 95, in handle

Ā  Ā  self.run(**options)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 102, in run

Ā  Ā  autoreload.run_with_reloader(self.inner_run, **options)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 599, in run_with_reloader

Ā  Ā  start_django(reloader, main_func, *args, **kwargs)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 584, in start_django

Ā  Ā  reloader.run(django_main_thread)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 299, in run

Ā  Ā  self.run_loop()

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 305, in run_loop

Ā  Ā  next(ticker)

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 345, in tick

Ā  Ā  for filepath, mtime in self.snapshot_files():

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 361, in snapshot_files

Ā  Ā  for file in self.watched_files():

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 260, in watched_files

Ā  Ā  yield from iter_all_python_module_files()

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 105, in iter_all_python_module_files

Ā  Ā  return iter_modules_and_files(modules, frozenset(_error_files))

Ā  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py", line 141, in iter_modules_and_files

Ā  Ā  resolved_path = path.resolve(strict=True).absolute()

TypeError: resolve() got an unexpected keyword argument 'strict'

udaysingh@udays-MacBook-Pro:~/Django/dreamProj>

Haris Ahmad

unread,
Jul 30, 2020, 5:53:19ā€ÆAM7/30/20
to django...@googlegroups.com
Hi there,
Resolved_path =pathlib.path.resolve(strict=True)

Use this, might work..Ā 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAANDXNtvg9sP5OqLktcECco1MhpV0%3DcMgYCKvAF0TLXAH9bpog%40mail.gmail.com.

Thierry DECKER

unread,
Jul 30, 2020, 5:53:19ā€ÆAM7/30/20
to django...@googlegroups.com
The resolve() method dose not have the strict parameter anymore.

Regards

--

oba stephen

unread,
Jul 30, 2020, 6:47:37ā€ÆAM7/30/20
to django...@googlegroups.com
Also try using a virtual environment.

Amitesh Sahay

unread,
Jul 30, 2020, 6:48:35ā€ÆAM7/30/20
to django...@googlegroups.com
It seems to me as if there is a mismatch of some in-built functionality. Can't say for exact though. Did you follow the migration rules from one version to another ?

Regards,
AmiteshĀ 


Mira

unread,
Jul 30, 2020, 7:29:04ā€ÆAM7/30/20
to django...@googlegroups.com
Thanks Thierray
I made change in Line 142 by removing removing default Parameter and its working fine for me but the question isĀ 
is Django 3.0.8 compatible with Python 3.6? If yes we wouldn't have to make a change in Django package like i made below?

140 Ā  Ā  Ā  Ā  try:

141 Ā  Ā  Ā  Ā  Ā  Ā  #resolved_path = path.resolve(strict=True).absolute()

142 Ā  Ā  Ā  Ā  Ā  Ā  resolved_path = path.resolve().absolute()

143 Ā  Ā  Ā  Ā  except FileNotFoundError:

144 Ā  Ā  Ā  Ā  Ā  Ā  # The module could have been removed, don't fail loudly if this

145 Ā  Ā  Ā  Ā  Ā  Ā  # is the case.

146 Ā  Ā  Ā  Ā  Ā  Ā  continue

147 Ā  Ā  Ā  Ā  except ValueError as e:

148 Ā  Ā  Ā  Ā  Ā  Ā  # Network filesystems may return null bytes in file paths.

149 Ā  Ā  Ā  Ā  Ā  Ā  logger.debug('"%s" raised when resolving path: "%s"' % (str(e), path))

150 Ā  Ā  Ā  Ā  Ā  Ā  continue

151 Ā  Ā  Ā  Ā  results.add(resolved_path)

152 Ā  Ā  return frozenset(results)

153Ā 

"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py" line 142 of 605 --23%-- col 13


ROHINI PUNDE

unread,
Jul 30, 2020, 10:59:25ā€ÆAM7/30/20
to django...@googlegroups.com
I have error while updating the information,so many trials I cant solve this problem,so please help me for this


--
error.png

RANGA BHARATH JINKA

unread,
Jul 30, 2020, 10:41:05ā€ÆPM7/30/20
to django...@googlegroups.com
Hi convert it into string while displaying it in models __str__.
Or use f-strings. It is easy. All the best šŸ‘

RANGA BHARATH JINKA

unread,
Jul 30, 2020, 10:42:16ā€ÆPM7/30/20
to django...@googlegroups.com
Send your models.py file

ROHINI PUNDE

unread,
Jul 31, 2020, 9:47:32ā€ÆAM7/31/20
to django...@googlegroups.com
from django.db import models
from django.contrib.auth.models import User

class Customer(models.Model):
user=models.OneToOneField(User,null=True,on_delete= models.CASCADE)
name=models.CharField(max_length=200,null=True)
phone=models.CharField(max_length=200,null=True)
email=models.CharField(max_length=200,null=True)
profile_pic = models.ImageField(default="radha3.png", null=True, blank=True)
date_created=models.DateTimeField(auto_now_add=True,null=True)
def __str__(self):
return self.name

class Tag(models.Model):
name=models.CharField(max_length=200,null=True)
def __str__(self):
return self.name

class Product(models.Model):
CATEGORY=(
('In door','In door'),
('Out door','Out door'),
)
name=models.CharField(max_length=100,null=True)
price=models.FloatField(null=True)
category = models.CharField(max_length=200, null=True,choices=CATEGORY)
description = models.CharField(max_length=200,null=True,blank=True)
date_created = models.DateTimeField(auto_now_add=True, null=True)
tags=models.ManyToManyField(Tag)

def __str__(self):
return self.name


class Order(models.Model):
STATUS = (
('Pending', 'Pending'),
('Out for delivery', 'Out for delivery'),
('Delivered', 'Delivered'),
)
customer = models.ForeignKey(Customer, null=True, on_delete=models.SET_NULL)
product = models.ForeignKey(Product, null=True, on_delete=models.SET_NULL)
date_created = models.DateTimeField(auto_now_add=True, null=True)
status = models.CharField(max_length=200, null=True, choices=STATUS)
note = models.CharField(max_length=1000, null=True)

def __str__(self):
return self.product.name



RANGA BHARATH JINKA

unread,
Aug 1, 2020, 1:05:00ā€ÆAM8/1/20
to django...@googlegroups.com
from django.db import models
from django.contrib.auth.models import User

class Customer(models.Model):
user=models.OneToOneField(User,null=True,on_delete= models.CASCADE)
name=models.CharField(max_length=200,null=True)
phone=models.CharField(max_length=200,null=True)
email=models.CharField(max_length=200,null=True)
profile_pic = models.ImageField(default="radha3.png", null=True, blank=True)
date_created=models.DateTimeField(auto_now_add=True,null=True)
def __str__(self):
        return str(self.name)


class Tag(models.Model):
name=models.CharField(max_length=200,null=True)
def __str__(self):
        return str(self.name)

class Product(models.Model):
CATEGORY=(
('In door','In door'),
('Out door','Out door'),
)
name=models.CharField(max_length=100,null=True)
price=models.FloatField(null=True)
category = models.CharField(max_length=200, null=True,choices=CATEGORY)
description = models.CharField(max_length=200,null=True,blank=True)
date_created = models.DateTimeField(auto_now_add=True, null=True)
tags=models.ManyToManyField(Tag)

def __str__(self):
        return str(self.name)


class Order(models.Model):
STATUS = (
('Pending', 'Pending'),
('Out for delivery', 'Out for delivery'),
('Delivered', 'Delivered'),
)
customer = models.ForeignKey(Customer, null=True, on_delete=models.SET_NULL)
product = models.ForeignKey(Product, null=True, on_delete=models.SET_NULL)
date_created = models.DateTimeField(auto_now_add=True, null=True)
status = models.CharField(max_length=200, null=True, choices=STATUS)
note = models.CharField(max_length=1000, null=True)

def __str__(self):
        return str(self.product.name)

Try this and let me know whether it is working or not. I added str() to the __str__. All the best



--
Thanks and Regards

J. Ranga Bharath
cell: 9110334114

Kyasanku Charles Nyombi

unread,
Aug 1, 2020, 1:34:55ā€ÆAM8/1/20
to django...@googlegroups.com
First of all what you did was wrong. You would have kept a Django 2.2 project in its own environment and installed the new Django version in a new environment. Another thing I would advice you is to use the latest version of python which is 3.8.4 I think with the latest version of Django. It works best there. To be on the safe side I would Advise you to rebuild your django 2.2 project with Django 3.8.4 or 3.1 because a lot has changed in these versions just fixing a single bug wonā€™t helpĀ you will run into another one thereafter. So just do it again.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAANDXNtvg9sP5OqLktcECco1MhpV0%3DcMgYCKvAF0TLXAH9bpog%40mail.gmail.com.
--
null
Reply all
Reply to author
Forward
0 new messages