Reputation: 4364
I've set:
ADMIN_MEDIA_PREFIX = 'C:/Python27/Lib/site-packages/django/contrib/admin/media/'
And in admin panel I've got such links to CSS:
<link href="C:/Python27/Lib/site-packages/django/contrib/admin/media/css/base.css" type="text/css" rel="stylesheet">
<link href="C:/Python27/Lib/site-packages/django/contrib/admin/media/css/dashboard.css" type="text/css" rel="stylesheet">
I watch this files - they are not empty. I tried to set static links to it in templates, but still nothing.
Upvotes: 1
Views: 1364
Reputation: 4364
The problem can be with register (non-latin symbols), so if you haven't styles in Django Admin - you may have such error, which cause this.
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 283, in run
self.result = application(self.environ, self.start_response)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 69, in __call__
return super(StaticFilesHandler, self).__call__(environ, start_response)
File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 273, in __call__
response = self.get_response(request)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 59, in get_response
return self.serve(request)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\handlers.py", line 52, in serve
return serve(request, self.file_path(request.path), insecure=True)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\views.py", line 39, in serve
return static.serve(request, path, document_root=document_root, **kwargs)
File "C:\Python27\lib\site-packages\django\views\static.py", line 54, in serve
mimetype, encoding = mimetypes.guess_type(fullpath)
File "C:\Python27\lib\mimetypes.py", line 294, in guess_type
init()
File "C:\Python27\lib\mimetypes.py", line 355, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 260, in read_windows_registry
for ctype in enum_types(mimedb):
File "C:\Python27\lib\mimetypes.py", line 250, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)
There is simple solution. Run regedit and watch in XP:
[HKEY_CLASSES_ROOT\CLSID\{4063BE15-3B08-470D-A0D5-B37161CFFD69}\EnableFullPage\MIME]
and in 7 such keys:
HKEY_CLASSES_ROOT\MIME\Database\Content Type
There must be invalid symbols (all must be in english), so you need rename some entries and all will work fine. But, really, it takes so long to connect endcode and style problems together. I hope this will save your time.
Upvotes: 1
Reputation: 239250
ADMIN_MEDIA_PREFIX
is a URL prefix, not a filesystem path. You need to just put the path off your domain or localhost, i.e.:
ADMIN_MEDIA_PREFIX = '/media/'
Will pull media from 'http://localhost:8000/media/' or 'https://mydomain.com/media/'.
Upvotes: 3