简体   繁体   中英

STATICFILES DJANGO

I have a problem with Django, managing static files.. I know there are already similar questions here and I have gone through them all and tried them, but an error still pops up. here is my code

STATICFILES_DIRS = [ 
BASE_DIR / "static", 
 ]

and the following message pops up

BASE_DIR/'static', TypeError: unsupported operand type(s) for /: 'str' and 'str'

Django is supporting pathlib starting from verson 3.1.

Make sure you are using supported Django version and your settings file has:

from pathlib import Path

BASE_DIR = Path(__file__).resolve(strict=True).parent.parent

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM