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>
DEBUG = True, it shows you a hell of debugging information when something like this happens. When you haveDEBUG = False, it emails you that information. If you haven't setup email properly, a quick-and-dirty way is to setDEBUG=Truein production to check out what's going on. Eventually, however, you will need to setup emailing correctly by setting theEMAIL_*settings. See also djangodeployment.com/2017/01/18/… to fool-proof these settings.