I am attempting to deploy a Django site that has the ability to upload a file and then modify that file. It works 100% on the dev server, however after deploying it with Apache I am running into problems. The Server Error (500) happens on the indicated line in my views.py. What am I doing wrong? My problem is probably not understanding the save() method, however I could not find any info/documentation that helped me.
views.py
def upload(request):
if request.method == "POST":
formU = FileUploadForm(request.POST, request.FILES)
if formU.is_valid():
f = request.FILES['myFile']
fs = FileSystemStorage()
set_file_name(str(f))
fs.save(str(f), f) # where error occurs
Since everything works fine under the dev server, I assumed it would be a media file thing but (I think) all looks good there.
settings.py
MEDIA_ROOT = os.path.join(BASE_DIR, "media/")
MEDIA_URL = '/media/'
proj.conf
Alias /media /home/4rsenal/f_proj/media
<Directory /home/4rsenal/f_proj/media>
Require all granted
</Directory>
If it was working on the dev server, it's probably not a Python error. I think you have a bad configuration of your virtualhost in proj.conf. Or you just forget to open rights on your folders ?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.