[PYTHON] Error handling during Django migrate'DIRS': [BASE_DIR /'templates']

(Django learning notes)

An error occurred when migrating db with django, so a correction memo.

Include / as a string and combine BASE_DIR and'templates' with the'+' operator.

Terminal (error content)


$ python manage.py migrate
・ ・ ・ ・
・ ・ ・ ・
  File "/Users/USERNAME/mybook/mybook/settings.py", line 57, in <module>
    'DIRS': [BASE_DIR / 'templates']
TypeError: unsupported operand type(s) for /: 'str' and 'str'

settings.py(Before correction)


    'DIRS': [BASE_DIR / 'templates']

settings.py(Revised)


    'DIRS': [BASE_DIR + '/templates']

It worked, but maybe it's a problem with the python version and the Django version.

Reference URL

Django DIRS issue(stackoverflow) Introduction to Python Django (3)

Recommended Posts

Error handling during Django migrate'DIRS': [BASE_DIR /'templates']
Python Error Handling
SikuliX error handling
django.db.migrations.exceptions.InconsistentMigrationHistory error handling
Django2.2 SQLite3 version error
Django settings.py SECRET_KEY error
About tweepy error handling
Error handling in PythonBox
GraphQL (gqlgen) error handling
Around feedparser error handling