[django]django 在apache2上部署静态文件如何加载

 

首先找到apache2的conf文件下的httpd.conf,添加如下信息:

Alias /static/ E:/wamp/Apache24/www/static/
<Directory E:/wamp/Apache24/www/static> 
    Options FollowSymlinks
    AllowOverride none
    Require all granted
</Directory>

django 工程下setting中对应设置:

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/

STATIC_URL = '/static/'
STATICFILES_DIRS = (
     os.path.join(BASE_DIR, "static"),
)
posted @ 2016-05-24 11:47  CQ_LQJ  阅读(1169)  评论(0编辑  收藏  举报