I have a web application which is deployed by the means of Flask. I’m using the OpenLayers map which requests a stylesheet in the folder scriptdir/theme/default. I’m not so happy with my solution, so I hope someone can give me a hint to do it better:
@app.route('/theme/default/style.css')
def get_openlayers_css():
return url_for('static', filename='jslib/theme/default/style.css')
The javascript console shows me this warning:
Resource interpreted as Stylesheet but transferred with MIME type text/html: http://localhost:5000/theme/default/style.css
OpenLayers.Map.OpenLayers.Class.initialize OpenLayers.js:424
...
The requested stylesheet is located in /static/jslib/theme/default/style.css and the OpenLayers.js file in /static/jslib. I thought about streaming the css file, but I’m new to flask and therefore I was not able to get this working.
Thanks in advance!
Greetings
you’d better configure your map with
theme: null[1] option, which will disable the autoloading of the css, and load it by yourself in the page.1 – http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.Map.theme