
上QQ阅读APP看书,第一时间看更新
How to do it...
Modify your path-related settings accordingly, instead of hardcoding the paths to your local directories, as follows:
# settings/_base.py
import os
BASE_DIR = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
)
# ...
TEMPLATES = [{
# ...
DIRS: [
os.path.join(BASE_DIR, 'myproject', 'templates'),
],
# ...
}]
# ...
LOCALE_PATHS = [
os.path.join(BASE_DIR, 'locale'),
]
# ...
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'myproject', 'site_static'),
]
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')