我正在尝试从我在Elastic Beanstalk上托管的Pyramid应用程序中提供一些静态css,png等。它在我的本地机器上工作正常但是当我尝试在EB上运行时,既没有找到CSS也没有找到图像。这是相关的代码:
来自.ebextensions:
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: pyramid.wsgi
aws:elasticbeanstalk:application:
Application Healthcheck URL: /health
aws:elasticbeanstalk:container:python:staticfiles:
"/static/": "static/"
来自home.make
<link rel="stylesheet" href="/static/css/settings/globals.css"/>
<link rel="stylesheet" href="/static/css/settings/colors.css"/>
<link rel="stylesheet" href="/static/css/objects/containers.css"/>
<link rel="stylesheet" href="/static/css/base/base.css"/>
<link rel="stylesheet" href="/static/css/components/articles.css"/>
<link rel="stylesheet" href="/static/css/components/divs.css"/>
<link rel="stylesheet" href="/static/css/components/footers.css"/>
<link rel="stylesheet" href="/static/css/components/globals.css"/>
<link rel="stylesheet" href="/static/css/components/headers.css"/>
<link rel="stylesheet" href="/static/css/components/img.css"/>
<link rel="stylesheet" href="/static/css/components/links.css"/>
<link rel="stylesheet" href="/static/css/components/lists.css"/>
<link rel="stylesheet" href="/static/css/components/paragraphs.css"/>
<link rel="stylesheet" href="/static/css/components/sections.css"/>
<link rel="stylesheet" href="/static/css/components/small.css"/>
<link rel="stylesheet" href="/static/css/state/links.css"/>
<link rel="stylesheet" href="/static/css/utilities/utilities.css"/>
来自static_config.py
from pyramid.security import NO_PERMISSION_REQUIRED
### INCLUDEME
def includeme(config):
"""Configure static endpoints.
"""
config.add_static_view(name='static',\
path='static',\
permission=NO_PERMISSION_REQUIRED)