I'm having issue with hosting Flask App on AWS with Elastic Beanstalk. I followed document on AWS(which seems a little old?), and did some workaround suggested here. It works if I have this folder structure:
--application.py /static /templates requirements.txt .ebextensions .elasticbeanstalk
However, I want to make my application more structured. So I moved my folder structure to and it stopped working
--application.py --.ebxtensions --.elasticbeanstalk /app - __init__.py - /static - /templates
What I have tried is changing the settings in optionsettings.myapp-env, suggested here. But I got no luck.
(P.S. App works fine except not recognizing the static files folder)
Any help would be appreciated!
Looks like you need to change the path mapping to: "/static/": "app/static/"
This mapping maps the virtual (what you refer in your html) to the directory structure. Since you have changed the dirs, now you need to change the mapping too.
Alternatively you can do the same conf in the AWS Beanstalk web console as well. Need not do in the configuration files.
This seems to be the most recent incarnation of this question and I figured I'd chime in since this just killed me for hours trying to figure out what the heck was wrong because my configuration settings were fine and the error logs and request logs didn't show any problems. I finally opened the developer console and saw I was getting an ERR_BLOCKED_BY_CLIENT for all of my static assets. Ghostery apparently treats elastic beanstalk as a cross-domain analytics tracker, so yet another gotcha that probably needs to be documented somewhere. It's simple enough to turn that off on my end, but I'm only running a site for fun. I'm not sure what you would do if you try to deploy an actual product to elastic beanstalk and Ghostery blocks all of your static assets. Your clients are probably just going to think your site sucks and won't think to look. I guess you better bundle it all directly or use a CDN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With