I have deployed a Django project on server using apache2 and wsgi, Its showing an error which I probably know that why its coming.
Error:
IOError at /
[Errno 13] Permission denied: 'bnr_code.csv'
Request Method: GET
Request URL: http://93.188.167.63:8080/pep_learn/
Django Version: 1.10.8
Exception Type: IOError
Exception Value:
[Errno 13] Permission denied: 'bnr_code.csv'
Exception Location: /home/pep_web/binaryDs/views.py in <module>, line 6
Python Executable: /usr/bin/python
Python Version: 2.7.12
I have tried some slandered solutions which are available as given bellow:
chmod 777 pep_web/
chmod 771 pep_web/
sudo chown :www-data pep_web/
But nothing is working
This is the file which uses 'bnr_code.csv'
AA = {"A":"1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"C":"0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"D":"0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"E":"0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"F":"0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"G":"0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
"H":"0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0",
"I":"0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0",
"K":"0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0",
"L":"0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0",
"M":"0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0",
"N":"0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0",
"P":"0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0",
"Q":"0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0",
"R":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0",
"S":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0",
"T":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0",
"V":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0",
"W":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0",
"Y":"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1"}
line = []
seqs = ["ATTTRY","ATSSRY"]
def bnr(x):
Des = []
for n in x:
Des.append(AA[n.upper()])
des = ",".join(Des)
return des
def Des_write(ps):
f = open("bnr_code.csv",'w')
for p in ps:
a = bnr(p)
f.write(p+','+a+'\n')
f.close()
Des_write(seqs)
Please help One can examine the error at http://93.188.167.63:8080/pep_learn/
Don't use a relative path to the file, use an absolute path. This issue is explained in the documentation for mod_wsgi.
Calculate the location of the file by doing: