Question

I've got a small problem where google app engine is complaining about my ttf file. This is what it says:

Could not guess mimetype for css/fonts/Pacifico.ttf.  Using application/octet-stream.

Now I've followed this link and changed my yaml file appropriately (or so I think):

- url: /css/fonts/(.*\.ttf)
    static_files: css/fonts/\1
    upload: css/fonts/(.*\.ttf)
    mime_type: application/x-font-ttf

But when I do this i get the following:

appcfg.py: error: Error parsing C:\Users\Roberto\Desktop\bootstrap\app.yaml: mapping values are not allowed here
  in "C:\Users\Roberto\Desktop\bootstrap\app.yaml", line 25, column 17.
2014-01-16 23:22:16 (Process exited with code 2)

Any help in this matter?

Was it helpful?

Solution

I have done a test with glyphicons-halflings-regular.ttf from the Bootstrap project with the same app.yaml handler that you use (save for the indentation change as per the comments) and can verify that it works as expected:

Developer tools showing correct content type

This leads me to believe that you may using an older version of the GAE SDK (I use 1.8.8) or something else is wrong with your installation.

You can try this: appcfg.py uses python's mimetypes module to guess the type from the file extension so in any case, you should be able to solve the issue by adding the application/x-font-ttf mime type to your OS.

You're on Windows so you need to edit your registry and add a application/x-font-ttf key to HKEY_CLASSES_ROOT\MIME\Database\Content Type and add a string value called Extension with the value .ttf under the new key.


Extended procedure for adding the mimetype to Windows

  1. Open the registry editor: Hit Winkey + R and type regedit, hit Enter
  2. Navigate through the registry to the desired location: open HKEY_CLASSES_ROOT, inside it open MIME, inside that open Database and inside that open Content Type. It's like a folder structure.
  3. Right click on Content Type and select New > Key, give it the name application/x-font-ttf.
  4. Right click on the key you just created and select New > String Value. give it the name Extension.
  5. Double click on the value you just created and assign it the Value data .ttf, hit OK.
  6. Exit regedit and you're done!

Final none: I don't think it can be anything to do with the file itself, because the mimetypes module uses only the file extension to work out the MIME type. Unless there is some crazy unprintable character in the filename. You could try using the glyphicons-halflings-regular font I linked to to eliminate this possibility.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top