Django 报错TypeError: argument of type 'PosixPath' is not iterable

在运行django时报错

 File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py", line 282, in is_in_memory_db
    return self.creation.is_in_memory_db(self.settings_dict['NAME'])
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/db/backends/sqlite3/creation.py", line 12, in is_in_memory_db
    return database_name == ':memory:' or 'mode=memory' in database_name
TypeError: argument of type 'PosixPath' is not iterable

 

因为Django中 setting中的一些写法发生了改变。

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3', 修改为:'NAME': str(BASE_DIR / 'db.sqlite3'), 就可以了
} }

 

posted @ 2021-05-15 11:52  TestingShare  阅读(351)  评论(0编辑  收藏  举报