My local machine is a virtual CeontOS-7 with a Python 2.7 virtualenv containing a Flask application directory, the structure is the following:
/var
/www
/myAppenv
/myApp
/.ebextensions
myApp-env.config
/.elasticbeanstalk
application.py
requirements.txt
/flaskApp
/core
views.py
models.py
forms.py
/templates
/static
and I deploy it from /myApp using EB CLI deploy to a Beanstalk application named myApp with an environment named myApp-env.
I think the static files path is set right in /.ebextensions/myApp-env.config:
option_settings:
"aws:elasticbeanstalk:container:python:staticfiles":
"/static/": "flaskApp/static/"
and I can see in AWS web console-> environment-> Configurations-> Software Configuration that
StaticFiles: /static/=flaskApp/static/
so the path setting doesn't seem to be the cause of the problem.
So when I open the web page for my application I see the page missing css and js, since everything from static directory gets a 403 forbidden response:
GET http://myApp-dev.elasticbeanstalk.com/ [HTTP/1.1 200 OK 174ms]
GET http://myApp-dev.elasticbeanstalk.com/static/bootstrap-3.3.5-dist/js/bootstrap.min.js [HTTP/1.1 403 Forbidden 55ms]
...
Guessing it's something about permissions, since in my local dir files are owned by my linux account (for samba reasons), then I tried to chown root and chgrp root (static dirs and files permissions are 755), but it didn't change anything. I actually don't think is anything related to firewall/selinux, by the fact that the home page is actually loading.
Does anybody know how to solve this problem?