在 Django 应用程序中生产时没有可用的照片
No photo available on production in django application
我在生产服务器上执行了命令 git pull。我下载了我最近的改动,就是把照片放到首页。
重新启动:supervisorctl restart myprocess
主页上没有图片。
照片放在文件夹"images",也就是位于静态。
我的代码在 html:
<img src="{% static 'images/logo.png' %}">
Firebug中的代码:
<img src="/static/images/logo.png">
你应该把你的静态文件放在你的 STATICFILES_DIRS 之一而不是 STATIC_ROOT 之后你需要做:
./manage.py collectstatic
然后它将通过以下方式提供:
<img src="{% static 'images/logo.png' %}">
我在生产服务器上执行了命令 git pull。我下载了我最近的改动,就是把照片放到首页。 重新启动:supervisorctl restart myprocess 主页上没有图片。
照片放在文件夹"images",也就是位于静态。 我的代码在 html:
<img src="{% static 'images/logo.png' %}">
Firebug中的代码:
<img src="/static/images/logo.png">
你应该把你的静态文件放在你的 STATICFILES_DIRS 之一而不是 STATIC_ROOT 之后你需要做:
./manage.py collectstatic
然后它将通过以下方式提供:
<img src="{% static 'images/logo.png' %}">