<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>Waarg</title><generator>Tumblr (3.0; @graaw)</generator><link>http://blog.waarg.co.uk/</link><item><title>Serving Django static media from the dev server.</title><description>&lt;h3&gt;Make sure your MEDIA_URL and ADMIN_MEDIA_PREFIX do not have the same path.&lt;/h3&gt;
&lt;p&gt;If, like me, you use the Django development server to statically serve your media files (css, javascript, images, etc) during development, you&amp;#8217;ll have come up against the head-bangingly annoying and unsolvable problem of it JUST NOT WORKING.&lt;/p&gt;
&lt;p&gt;You&amp;#8217;ve done everything right:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Syntactically correct static URL conf in your urls.py&lt;/li&gt;
&lt;li&gt;Directory structure containing media files matching MEDIA_ROOT, with correct permissions.&lt;/li&gt;
&lt;li&gt;MEDIA_URL context processor correctly set up and outputting into the template.&lt;/li&gt;
&lt;li&gt;Correct paths to media files in your HTML.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;But your media files just return 404? Tried starting and stopping the development server? Still doesn&amp;#8217;t work?&lt;/p&gt;
&lt;p&gt;Can&amp;#8217;t find any mention in the &lt;a target="_blank" href="https://docs.djangoproject.com/en/dev/howto/static-files/"&gt;Django documentation on static files&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;Try this:&lt;/p&gt;
&lt;p&gt;Make sure your ADMIN_MEDIA_PREFIX setting is DIFFERENT from the path portion of your MEDIA_URL.&lt;/p&gt;
&lt;p&gt;If your MEDIA_URL is &amp;#8216;http://127.0.0.1:8000/media&amp;#8217; and your ADMIN_MEDIA_PREFIX is &amp;#8216;/media/&amp;#8217; it WILL NOT WORK.&lt;/p&gt;
&lt;p&gt;This has caught me out so many times that I am now habitually setting my ADMIN_MEDIA_PREFIX to &amp;#8216;/thisisbonkers/&amp;#8217; just to be sure.&lt;/p&gt;</description><link>http://blog.waarg.co.uk/post/10764951311</link><guid>http://blog.waarg.co.uk/post/10764951311</guid><pubDate>Wed, 28 Sep 2011 08:32:00 -0400</pubDate><category>django</category></item></channel></rss>

