pptt
pptt

Reputation: 705

Django how to change admin urls?

i have a problem. In my project i am uploading file, it gets saved perfectly fine. It is accessible. I save it to the static/assets/uploaded files, ten generate the name: time + original filename.

But in django admin page i can't access it: (link that admin page gives me)

http://127.0.0.1:8000/admin/project/minipost/4/uploaded_files/1428326830_08_name.pdf/

The correct url would be:

http://127.0.0.1:8000/static/assets/uploaded_files/1428326830_08_name.pdf/

I have no idea how do i change or redirect or whatever the admin generated link to the correct one? Thanks in advance.

Upvotes: 1

Views: 378

Answers (1)

pptt
pptt

Reputation: 705

The problem was indeed MEDIA_URL

I just had to set it correctly:

MEDIA_ROOT = '/home/work/django-work/workproject/static/'

MEDIA_URL = '/static/assets/'

Upvotes: 1

Related Questions