django on cpanel returnt 404 uploading file

Submitted 1 year, 10 months ago
Ticket #36
Views 339
Language Django
Priority Urgent
Status Closed

i am having a problem uploading files to my server (shareserver) in cpanel.

when I upload a file either by admin or by a view it responds 404

if someone has help I would be very grateful


DEBUG = True
STATIC_URL = '/static/'
STATIC_ROOT  =   os.path.join(BASE_DIR, 'staticfiles')

# STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static/'),)

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static/media/')

    os.path.join(BASE_DIR, 'static'),
    os.path.join(BASE_DIR, 'media'),


    'whitenoise.middleware.WhiteNoiseMiddleware', ...


...] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT, show_indexes= True
) + static(
    settings.STATIC_URL, document_root=settings.STATIC_ROOT


class Product(models.Model):
    name = models.CharField(max_length=50)
    produc_pic = models.ImageField(default = '',null=True, blank=True)


<IfModule Litespeed>

WSGIScriptAlias / /home/ibhfrwld/ferre-bianconeri/ferreteria-bianconeri/ferre/

<Directory /home/ibhfrwld/ferre-bianconeri/ferreteria-bianconeri/ferre>
Require all granted

Alias /media/ /home/ibhfrwld/ferre-bianconeri/ferreteria-bianconeri/media/
Alias /static/ /home/ibhfrwld/ferre-bianconeri/ferreteria-bianconeri/static/

<Directory /home/ibhfrwld/ferre-bianconeri/ferreteria-bianconeri/static>
Require all granted

<Directory /home/ibhfrwld/ferre-bianconeri/ferreteria-bianconeri/media>
Require all granted

Submitted on Jul 08, 20
add a comment

1 Answer

Ok seems like some kind of permission or setting issue. As you have enabled DEBUG true, you should able able to see the what the actual error detail right?

Submitted 1 year, 10 months ago

yes in [DEBUG = True] and only show 404 page not found error, i can't see more detail error

- kopacanova47 1 year, 10 months ago

ok so page are also rendering perfectly right? . Only image is not able view, If that is the case, did you run collectstatic?

- scott 1 year, 10 months ago

yeap i run collectstatic before turn on server on cpanel. and all statics like css and js are runing normal

- kopacanova47 1 year, 10 months ago

may be try change the MEDIA file directory, looks like its not pointing to the right folder, MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/'

- scott 1 year, 10 months ago

As we are not getting any update on this ticket. We are closing the ticket.

- arun 1 year, 10 months ago

Wanna Post Ad?
Reach a large group of audience by posting an ad about your business here. For more details
Drop us a Message