Static files for Pyramid Application on Elastic Beanstalk

只谈情不闲聊 提交于 2019-11-30 18:11:37

问题


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)

来源:https://stackoverflow.com/questions/47046273/static-files-for-pyramid-application-on-elastic-beanstalk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!