Skip to content
Home ยป Solve “PermissionError: [Errno 1] Operation not permitted” when deploying to DigitalOcean

Solve “PermissionError: [Errno 1] Operation not permitted” when deploying to DigitalOcean


I’m a data scientist. Deploying is not part of my core skills, but something I need to be able to do when working on hobby projects. I recently embraced DigitalOcean to deploy my Django (Python) Project and want to elaborate on a problem I ran into.

The error that appeared in the log files when building and deploying my application to the DigitalOcean App Platform was the following:

PermissionError: [Errno 1] Operation not permitted

It was followed the worker exiting and a display of the Python traceback logs. Judging from the error message, it’s got something to do with permission. Given the fact that the traceback ends with os.fchmod(…), there’s no doubt about it.

PermissionError: [Errno 1] Operation not permitted error message

Apparently, gunicorn’s worker heartbeat temporary file has no access to the default directory on DigitalOcean. Solving it is extremely easy and is actually covered in the extensive deployment documentation that DigitalOcean provides.

In the app dashboard in DigitalOcean’s app platform, go to the components tab and edit the build and run command.

digitalocean run command

Edit the run command and change it to:

gunicorn --worker-tmp-dir /dev/shm <YOUR_DJANGO_PROJECT_NAME>.wsgi

Replace YOUR_DJANGO_PROJECT_NAME with the name of your Django project. Most likely, this is the name of the root folder of your project.

Congratulations, you can now deploy your app properly.

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.

4 thoughts on “Solve “PermissionError: [Errno 1] Operation not permitted” when deploying to DigitalOcean”

Leave a Reply

Your email address will not be published. Required fields are marked *