Serving static files in elastick beanstalk

Tags: , , ,

I’m deploying a python3 flask application in aws elasitc beanstalk (Amazon Linux 2 platform). The folder structure is as follows:

|   |-css/
|   |-js/

In the template files, importing of static resources are defiled as: i.e. JS file:

<script type="text/javascript" src="{{ url_for('static', filename='js/jquery.js') }}"></script>

In the EB configurations, I’ve defined the static resources as below

enter image description here

But the problem is, these resources are not loading and giving 404. i.e.: cannot be loaded. But if I try, it works.

Have I done the configurations wrong??


Based on the comments.

The issue was due to overwriting /static path. In python EB environments, /static path is used by default to server the static content:

By default, the proxy server in a Python environment serves any files in a folder named static at the /static path. For example, if your application source contains a file named logo.png in a folder named static, the proxy server serves it to users at You can configure additional mappings as explained in this section.

The solution was to use the default settings and remove the overwrite.

Source: stackoverflow