[Django]-Wsgi user permissions on elastic beanstalk

3👍

This is happening because the uWSGI worker is running under a user with limited permissions. You need to create the .newspaper_scraper/memoized directory first, and set the correct permissions on it (allow others to r/w). You can do this on deployment by making a script in .ebextensions that EB executes upon deployment.

Create a file in .ebextensions/setup_newspaper.config and add the following to it:

.ebextensions/setup_newspaper.config

packages:
  yum:
    libxslt-devel: []
    libxml2-devel: []
    libjpeg-devel: []
    zlib1g-devel: []
    libpng12-devel: []

container_commands:
  01_setup_newspaper:
    command: mkdir -p /home/wsgi/.newspaper_scraper/memoized && chmod 644 /home/wsgi/.newspaper_scraper/memoized

PS: It looks like newspaper requires some extra packages to be installed, so I added them too.


Read more info on .ebextensions here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-container.html#create-deploy-python-custom-container

Leave a comment