我有关于Django和自定义字体的问题..我尝试使用这种类型的自定义字体的方式
@font-face {
@font-face {
font-family: 'abc';
src: url('abc.eot');
src: url('abc.woff');
src: url('abc.ttf');
font-weight: normal;
font-style: normal;
}
}
或此类型
@font-face {
@font-face {
font-family: 'abc';
src: url('abc.eot');
src: url('abc.eot?#iefix') format('embedded-opentype'),
url('abc.woff') format('woff'),
url('abc.ttf') format('truetype'),
url('abc.svg#cde') format('svg');
font-weight: normal;
font-style: normal;
}
}
Django的内置服务器(“python manage.py runserver”)正在打印
Traceback (most recent call last):
File "C:\Python34\lib\wsgiref\handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "c:\users\myName\documents\github\django-trunk\django\contrib\staticfiles\
handlers.py", line 65, in __call__
return super(StaticFilesHandler, self).__call__(environ, start_response)
File "c:\users\myName\documents\github\django-trunk\django\core\handlers\wsgi.p
y", line 191, in __call__
response = self.get_response(request)
File "c:\users\myName\documents\github\django-trunk\django\contrib\staticfiles\
handlers.py", line 55, in get_response
return self.serve(request)
File "c:\users\myName\documents\github\django-trunk\django\contrib\staticfiles\
handlers.py", line 48, in serve
return serve(request, self.file_path(request.path), insecure=True)
File "c:\users\myName\documents\github\django-trunk\django\contrib\staticfiles\
views.py", line 41, in serve
return static.serve(request, path, document_root=document_root, **kwargs)
File "c:\users\myName\documents\github\django-trunk\django\views\static.py", li
ne 68, in serve
response["Last-Modified"] = http_date(statobj.st_mtime)
File "c:\users\myName\documents\github\django-trunk\django\utils\http.py", line
119, in http_date
return formatdate(epoch_seconds, usegmt=True)
File "C:\Python34\lib\email\utils.py", line 175, in formatdate
now = time.gmtime(timeval)
OSError: [Errno 22] Invalid argument
"GET /this/is/the/correct/path/customfont.css HTTP/1.1" 500 59
如果我通过<link>
链接customfont.css,将内容复制并粘贴到我的base.css(正确加载)或使用{{1}将其嵌入到.html文件中并不重要}。我也试过不同的字体。
摘自我的settings.py:
<script>@font-face..</script>
即使我现在还没有使用DEBUG = True
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'CEST'
USE_I18N = True
USE_L10N = True
USE_TZ = True
以外的任何内容。
如果重要的话,我的机器正在运行Windows 8 64位。
任何想法? TY
答案 0 :(得分:0)
看起来问题出现在文件本身的“上次修改”值中。可能该文件是在带有偏移时钟的计算机上创建的,或者是一些这样的。
价:
尝试使用以下命令更新文件:
copy /b customfont.ttf +,,
(这是Windows等效的* nix“touch”命令,参考:https://superuser.com/a/764721/66285)