On Django new version 3.1, the settings file have some changes, and I came to ask how I have to proceed to set my static files? The way that I usually did doesn't work more.
Last versions:
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Version 3.1:
from pathlib import Path
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
I usually set my static files like this:
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static_root')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media_root')
If I insert the import os will work, but is it the right practice?
What is the best practice to set this?
Thank you?