Closed GoogleCodeExporter closed 9 years ago
Original comment by bros...@gmail.com
on 15 Dec 2008 at 5:51
This issue makes it hard to customize Pinax with your own site_media directory
stored
elsewhere unless you start hacking the urls.py file. So a correction to this
defect
would be appreciated.
Original comment by pyDanny
on 22 Jan 2009 at 5:09
The way static files are served during development has changed since
introducing the build_media command and a distinct
view. document_root isn't required anymore.
The matching path could be set to MEDIA_URL[1:] assuming it would never be a
full URL in development.
if settings.SERVE_MEDIA:
urlpatterns += patterns('',
(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:], 'misc.views.serve')
)
But I think it's a bit ugly and hides the fact that serving static media with
Django is in fact a makeshift solution. Hence I'll
soon close this ticket as WontFix unless I get a storm of boos. What do you
think?
Original comment by leidel
on 1 Mar 2009 at 3:58
I think we're crossing paths here (no pun intended :-)). The problem is that
MEDIA_ROOT (not MEDIA_URL) is ignored by the urls.py file for all the projects.
There
are two solutions, either use MEDIA_ROOT for static content or put a comments in
settings.py that MEDIA_ROOT does not affect what relative folder static media is
pulled from. Either way is fine for me so that people don't change MEDIA_ROOT
expecting a change that won't happen.
I would say just add a comment to settings.py if you want to get close to a
WONTFIX.
Original comment by arocki...@gmail.com
on 2 Mar 2009 at 2:49
MEDIA_ROOT isn't ignored. In trunk it actually is used by both, the build_media
management command and its equivalent static file serving view for local
development.
Original comment by leidel
on 2 Mar 2009 at 3:20
I've been sloppy with my use of MEDIA_ROOT and MEDIA_URL, I apologize. I'm still
updating my skillset from PHP to Python/Django.
--------
If one goes to this URL, one gets the logo image
http://127.0.0.1:8000/site_media/pinax/images/logo.png
If one changes MEDIA_URL in settings.py to "/images/", the following URL does
not
work. It is still the URL with site_media:
http://127.0.0.1:8000/images/pinax/images/logo.png
One has to modify the urls.py file directly to make the change:
pinax/projects/complete_project/urls.py:103-106
if settings.SERVE_MEDIA:
urlpatterns += patterns('',
(r'^site_media/(?P<path>.*)$', 'misc.views.serve')
)
To:
if settings.SERVE_MEDIA:
urlpatterns += patterns('',
(r'^%s(?P<path>.*)$' % settings.MEDIA_URL, 'misc.views.serve')
)
--------
I would propose making that change to urls.py and changing MEDIA_URL to
'site_media/'
(without the leading slash in my example, or with it in yours). If somebody is
using
a non-development server it won't matter, and if they are using the development
server, it makes it easy to make the change (for first time users).
Anyway, this is really a trivial problem - I'm fine with marking this as
WONTFIX and
moving on.
Original comment by arocki...@gmail.com
on 2 Mar 2009 at 3:49
Leidal, can you WontFix this or set it to a milestone?
Original comment by pyDanny
on 13 Mar 2009 at 4:13
Original comment by leidel
on 13 Mar 2009 at 4:25
Original issue reported on code.google.com by
arocki...@gmail.com
on 15 Dec 2008 at 4:23