Code

Opened 8 years ago

Closed 2 months ago

Last modified 2 months ago

#1349 closed Cleanup/optimization (fixed)

MEDIA_URL and MEDIA_ROOT do not serve the files

Reported by: lzap@… Owned by: timo
Component: Documentation Version:
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I use latest stable:

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = '/home/lzap/public_html/nc/media/',

# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
MEDIA_URL = '/media/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media_admin/'

I start the devel server on port 8080 and try to access some files from the media directory. I always get 404. I tried to set the MEDIA_URL either to '/media' or to 'http://localhost:8080/media' but with no luck. Strace commands shows the Python is not trying to access a disc - it simply do not recognize the URL.

I know I should a web server for this, but I do not want to run an Apache for developing. The documentation is brief about this settings. I think this is a bug or something.

Attachments (0)

Change History (9)

comment:1 Changed 8 years ago by lzap@…

I was told to use 'flatfiles' but this seems to be "pages in a database".

How to setup the devel server to serve static files? Are these MEDIA_* settings the right place? If so why this doesnt work?

comment:2 Changed 8 years ago by anonymous

  • Resolution set to invalid
  • Status changed from new to closed

Check out http://www.djangoproject.com/documentation/static_files/

Please don't use bug tracker for support q - django-users mailing list is the place.

comment:3 Changed 8 years ago by anonymous

You should wrote in the documentation near the MEDIA_URL (or in the tutorial) that man needs to use django.views.static.serve for this...

comment:4 Changed 8 years ago by anonymous

And please note this is very unclear. I thought this was a bug... The documentation do not shows what is MEDIA_* for...

comment:5 Changed 2 months ago by anonymous

  • Easy pickings unset
  • Resolution invalid deleted
  • Status changed from closed to new
  • UI/UX unset

This *still* needs documentation fixes! No where near MEDIA_* is this mentioned!

comment:6 Changed 2 months ago by timo

  • Component changed from Core (Other) to Documentation
  • Owner changed from adrian to timo
  • Severity changed from major to Normal
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from defect to Cleanup/optimization

comment:7 Changed 2 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In fb7c347f7bd360b567c0b30697a6a200be2d6778:

Fixed #1349 -- Clarified docs on serving files from STATIC/MEDIA_URL.

comment:8 Changed 2 months ago by Tim Graham <timograham@…>

In 5783088eecddd935be3c641437748040669f91c0:

[1.6.x] Fixed #1349 -- Clarified docs on serving files from STATIC/MEDIA_URL.

Backport of fb7c347f7b from master

comment:9 Changed 2 months ago by Tim Graham <timograham@…>

In 2a2d7db01f0032c9dbf446757c121fa2a5904a45:

[1.7.x] Fixed #1349 -- Clarified docs on serving files from STATIC/MEDIA_URL.

Backport of fb7c347f7b from master

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.