django前端怎么设置 静态文件路径

如题所述

设置一个路径变量
APP_PATH=os.path.dirname(os.path.dirname(__file__))
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# 注意要修改STATIC_ROOT变量
STATIC_ROOT = os.path.join(APP_PATH,'static').replace('\\','/')

# URL prefix for static files.
# Example: ample.com/static/", "h ic.example.com/"
STATIC_URL = '/static/'

# 当然还有STATICFILES_DIRS变量
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
os.path.join(APP_PATH,'mobile_oa_server/static').replace('\\','/'),
)
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网