Commits

Anonymous committed b134b2e

added data directory as an another static directory.
now you can show image using image directive, e.g., `.. image:: myimage.png`.

  • Participants
  • Parent commits 2002214
  • Tags v0.0.1

Comments (0)

Files changed (2)

 syntax: glob
 *.db
+data
 from sqlite3 import dbapi2 as sqlite3
 from contextlib import closing
 from flask import Flask, request, session, g, redirect, url_for, abort, \
-     render_template, flash
+     render_template, flash, send_from_directory
 from docutils.core import publish_parts
 
 
 SECRET_KEY = 'development key'
 USERNAME = 'admin'
 PASSWORD = 'default'
+DATADIRPATH = fromhere('data')
 
 # disable docutils security hazards:
 # http://docutils.sourceforge.net/docs/howto/security.html
         return redirect(url_for('edit', title=title))
 
 
+@app.route('/data/<path:filepath>')
+def data_file(filepath):
+    return send_from_directory(app.config['DATADIRPATH'], filepath)
+
+
 if __name__ == '__main__':
     app.run()