I'm stuck trying to solve a "403 Forbidden" error in my Elastic Beanstalk Flask application. I have set up my python.config file as below:
option_settings:
aws:elasticbeanstalk:container:python:staticfiles:
"/static/": "/static/"
"/templates/": "/templates/"
commands:
01_set_file_permissions:
command: "chmod 777 /opt/python/current/app/static/"
The static folder was initially giving a 404 but the static files section of python.config fixed that. My problem is I can't get the file permissions to be recognised on the server. It always returns a 403 error. Please help.
I worked out the fix. The option_settings section was incorrect in that the route to folder was not given as a relative path. Also the /static/ folder was already set via a hard-coded value in the AWS console at:
AWS > Elastic Beanstalk > > Configuration > Software Configuration > Virtual Path. I needed to change the value of /static/ to static/ here.
Finally the commands section was not required at all. The fixed python.config file (that works) is as follows:
option_settings:
aws:elasticbeanstalk:container:python:staticfiles:
"/templates/": "templates/"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.