Open
Description
The best practice suggests using forward slashes, even while on Windows. An even better practice would be to use the build in os
module to join paths together. This technique is also OS independent since it knows to use the correct directory separator. Furthermore, it's a part of the Python standard library and Django even sets up a BASE_DIR
variable in your settings automatically when creating a project.
In your settings.py:
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
# etc...
]
Metadata
Metadata
Assignees
Labels
No labels