Static files for Pyramid Application on Elastic Be

2020-03-04 04:10发布

问题:

I'm trying to serve some static css, png's, etc. from my Pyramid app that's hosted on Elastic Beanstalk. It works fine on my local machine but when I try to run on EB, neither the CSS nor the images are found. Here's the relevant code:

From .ebextensions:

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: pyramid.wsgi
  aws:elasticbeanstalk:application:
    Application Healthcheck URL: /health
  aws:elasticbeanstalk:container:python:staticfiles:
    "/static/": "static/"

From 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"/>

From 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)