I have a Flask app hosted on a Linode server. I have a script to fetch a json and write it to a file. When I run this script getprice.py on my server I get the error [Errno 13] Permission denied: 'app/static/prices.json. It works fine on my local machine though. What do I have to do to get it working?
The answer is in your question. The user your script is running as on the server doesn't have write permissions on 'app/static'. It may be helpful if you also posted the getprice.py code, but it seems like a pretty straightforward file permission problem.
Related
I am trying to run my program with vercel but it doesn't work. It works fine when I run the program locally on my computer but I keep getting an error when I try to open a file.
This is the line i get the [ERROR] OSError: [Errno 30] Read-only file system: on
with open(f'player_jsons/{name}_info.json', 'a+') as data:
I read something about it not working on aws and it being that you cant creat/write to files and you have to use /tmp or something like that? I was using pythonanywhere which worked perfectly fine to host it before but you cant use threading on there so I am trying to switch to vercel but this is being annoying.
I am trying to figure out "To Solve Permission Denied Problem for script.py" python script Hosted on UBUNTU Linux apache2 server. The app is facing problem when I try to use
os.mkdir(os.path.join("/var/www/mysite.com/public_html/uploads", "newfolder"))
Note - app is using mod_wsgi, flask and python 3.x.x version.
This raises an Error 13 Permission denied error. However I tried the same from command line through putty by using
python3
import os
os.mkdir(os.path.join("/var/www/mysite.com/public_html/uploads", "newfolder"))
This created the folder actually. But I don't know why script is failing to create the same in case of execution.
Also Permission is set to "775" for script.py file.
so I'm having the weirdest problem! I have a python script which was working just fine and accessing a local mongodb and all was good.. then I wanted to add a new feature but I wanted to try it first so I copied my script into a new file and when I tried to run it it didn't access to mongodb and it kept on giving me this error pymongo: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions
BUT the old script is still working just fine!!
I searched every were google could have taken me and tried everything I know but the problem is still there all new scripts are giving me this error and all old ones are working just fine..
can anyone please help me?
the problem was with the antivirus.. I have comodo antivirus and it has been blocking the scripts,, I unblocked them and now they work :)
I have a django file server. The server works perfectly on my laptop & localhost (with external hard drive) but when I transferred it to my Raspberry Pi running Raspbian, it starts acting up.
I did a lot of googling and tried every possible solution but it does not work.
Here is my problem:
I have connected an external hard drive to my raspberry pi. I believe it has write permissions because I can easily write to it with mkdir. I have also set this directory which is /media/pi/SAMSUNG/media as my MEDIA_ROOT.
Now I have set up Apache2, WSGI and Django, everything works, I have set up all the permissions and everything, but still when django tries to access the hard drive, whether it be to read or write, I get an error [Errno 13] Permission denied: '/media/pi/SAMSUNG'.
I have fixed this in the past with chown -R 777 but it does not work this time.
Unfortunetly, I have no idea what I am doing when it comes to servers and file permissions, so I have no idea what code to attach. Can some please help me?
I will attach all the necessary code on request.
Thank you
On raspbian you have to be careful when using external drives. Have you edited the file /etc/fstab? This is necessary to mount the drive also correctly after restarts and when the file is temporarily disconnected and then connected again.
If you did this correctly, then the drive will have the permissions you gave it when mounting and Django should be able to access it/write to it.
BR
Not certain if this belongs here or on SU
I'm developing a Django app and I'm having a problem with logfiles. I have a logger configured to write to /var/log/django/django.log. When I try to start the server, I get a 500 error, and the error log says
ValueError: Unable to configure handler 'djangologfile': [Errno 13] Permission denied: '/var/log/django/django.log'
"httpd/error_log" 480L, 61112C
The permissions for both django.log and the django directory are 777. Why can't the server write to the file?
Well, the easy way to test this is to sudo as a user the server is running under and try to ls /var/log/django/django.log. If that fails you might get insight into what the problem is.