Commits

masklinn committed 16dc743

Remove moving around of Flask static files and templates

need to fixup later for better unification, but for now aim is to remove/clarify usage of flask

Comments (0)

Files changed (2)

                      search=app.config['SEARCH'],
                      storage=app.config['DATABASE_URI'])
 support.build()
-
-# copy resources from this webapp
-for name in ['static', 'templates']:
-    source_dir = os.path.join(os.getcwd(), 'sphinxweb', name)
-    target_dir = os.path.join(app.config['BUILD_DIR'], name)
-    copy_static_entry(source_dir, target_dir, None)

sphinxweb/__init__.py

 import sys
 from os import path
 
-from flask import Flask, g, session, url_for
+from flask import Flask, g, session, url_for, send_from_directory
 from flask.ext.mail import Mail, Message
 
 from sphinx.websupport import WebSupport
 
 app = Flask(__name__)
 app.config.from_envvar('SPHINXWEB_SETTINGS')
-app.root_path = app.config['BUILD_DIR']
+
+@app.route('/static/_<section>/<path:name>')
+def sphinx_statics(section, name):
+    directory = path.join(app.config['BUILD_DIR'], 'static', '_' + section)
+    return send_from_directory(directory, name)
 
 mail = Mail(app)