问题描述
依照官方文档添加静态文件, 执行命令python managy.py runserver
时运行正常, 执行命令gunicorn -k gevent mysite.wsgi
时加载静态文件报错404
.
解决方案
修改mysite/wsgi.py
...
from django.contrib.staticfiles.handlers import StaticFilesHandler # 添加模块
# 修改 application = get_wsgi_application()
application = StaticFilesHandler(get_wsgi_application())
Nail it! Nice and neat.