Hello, in my settings.py I have the following:
PROJECT_DIR = os.path.dirname(os.path.realpath(__file__))
MEDIA_ROOT = os.path.join(PROJECT_DIR,'templates')
MEDIA_URL = '/templates/'
In urls.py I have (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
And my base.html has the following directive:
<link media="screen" href="site_media/bat/design/css/bat.css" type="text/css" rel="stylesheet" />
Upon first entry into the application (i.e. http://localhost) this stylesheet gets loaded just fine. However, on a subsequent http request (in urls.py it is (r'^assist/bat/', include('assist.bat.urls'))
, to another template this directive results in the following error:
The stylesheet http://localhost/assist/bat/site_media/bat/design/css/bat.css was not loaded because its MIME type, "text/html", is not "text/css."
As you can see, this css directive gets morphed into a relative url which is completely incorrect. If I remove /assist/bat from that url, then it works just fine. So how can I set up my app to not morph url's this way?
Thanks, Igor