title: With Flask, how can I serve robots.txt and sitemap.xml as static files?
body: <p>I've read on quiet a few places that serving static files should be left to the server, for example in a couple of the answers on this <a href="https://stackoverflow.com/questions/4239825/static-files-in-flask-robot-txt-sitemap-xml-mod-wsgi">SO question</a>. But I use the OpenShift PaaS, and can't figure out how to modify the .htaccess file there.</p>
  
  <p>I came across this <a href="http://code.google.com/r/lipiridis-skiptrack/source/browse/main/sitemap.py?spec=svn8cd861620861a94f984a5bc2de2fcbda2773296e&amp;r=8cd861620861a94f984a5bc2de2fcbda2773296e" rel="noreferrer">piece of code</a> that serves the sitemap from a template. I did that on my app for both the sitemap, and robots.txt, like so -</p>
  
  <pre><code>@app.route("/sitemap.xml")
  def sitemap_xml():
      response= make_response(render_template("sitemap.xml"))
      response.headers['Content-Type'] = 'application/xml'
      return response
  
  @app.route("/robots.txt")
  def robots_txt():
      return render_template("robots.txt")
  </code></pre>
  
  <p>Is there any harm in this, or is my approach okay?</p>