slyapustin / django-classified

Django Classified
https://github.com/slyapustin/django-classified-demo
MIT License
171 stars 77 forks source link

image upload fails #43

Closed typonaut closed 4 years ago

typonaut commented 4 years ago

When attempting to upload an image I get an extensive error/debug message.

slyapustin commented 4 years ago

@typonaut Can you please provide more details? Please take a look to the demo project https://github.com/inoks/django-classified-demo

typonaut commented 4 years ago

I'd go through it step by step, but the demo site is not currently working:

https://django-classified.herokuapp.com/


Application error

An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command heroku logs --tail


Let me know when you have a demo site working again and I'll recreate the problem.

Essentially, I created an account and uploaded an image file, but when I did this it created an error in the application and didn't load the image. You can probably see this is a problem as no other demo ads had images.

slyapustin commented 4 years ago

@typonaut That should not be related to the image upload.
I have an issue with the free app quota usage on Heroku. That demo app has received a lot of traffic recently, which is not covered by the free plan on the Heroku. I will create a separate demo app instance on another cloud platform.

typonaut commented 4 years ago

So, I tried the demo site again, and I got the same response when I try to add an image file to the classified ad:

"RecursionError at /edit/56/ maximum recursion depth exceeded while calling a Python object"

I tried attaching this, but no luck, so here's a URL:

http://www.indx.co.uk/clive/django/classifieds/RecursionError_at__new_.htm

typonaut commented 4 years ago

I am now able to add images without error when submitting them. However, those uploaded images do not show in the browser.

The HTML gives a URL:

cache/f9/e9/f9e97fee4dce9a7a1c939645b6bf6fb1.jpg

runserver in terminal shows this (404)

Not Found: /django_classified/static/cache/f9/e9/f9e97fee4dce9a7a1c939645b6bf6fb1.jpg [05/Feb/2020 16:38:50] "GET /django_classified/static/cache/f9/e9/f9e97fee4dce9a7a1c939645b6bf6fb1.jpg HTTP/1.1" 404 5050

And I find the files actually here:

~/cache/f9/e9/f9e97fee4dce9a7a1c939645b6bf6fb1.jpg

Is there a setup step I am missing to link the requested URLs to the actual file locations?

Also, not sure it is necessary to with file types from the uploaded .png to a .jpg!?

slyapustin commented 4 years ago

@typonaut Can you somehow share your project or some part of it, so I can investigate that issue? It's not clear to me why this recursion error is happening. Also, I notice you use a pretty old version of the demo app project.

slyapustin commented 4 years ago

@typonaut Nevermind, I see why it's happening.

slyapustin commented 4 years ago

This is fixed now.

typonaut commented 4 years ago

I can confirm that everything is now functioning as expected.