From 8c387ab78727a1bdbea5150c4d2d26281f8a125a Mon Sep 17 00:00:00 2001 From: Jamie Steiner Date: Wed, 5 Nov 2014 17:33:12 +0200 Subject: [PATCH] changed static tructure --- .gitignore | 5 ++--- app.py | 7 ++++++- config/config.py | 1 + {static => custom}/custom.js | 0 {static => custom}/style.css | 0 templates/index.html | 2 +- templates/layout.html | 2 +- 7 files changed, 11 insertions(+), 6 deletions(-) rename {static => custom}/custom.js (100%) rename {static => custom}/style.css (100%) diff --git a/.gitignore b/.gitignore index 722dfac..5c79173 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,8 @@ *.pyc venv/ static/* -!static/custom.js -!static/style.css env/* !env/__init__.py !env/email.py.example -!env/env.py.example \ No newline at end of file +!env/env.py.example +.DS_Store \ No newline at end of file diff --git a/app.py b/app.py index 616d937..7509f04 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,5 @@ -from flask import Flask, render_template, request, session, redirect, url_for +from flask import Flask, render_template, request, session, redirect, url_for, send_from_directory from flask.ext.babel import Babel from flask.ext.mail import Mail from flask.ext.bcrypt import * @@ -21,6 +21,7 @@ app.config.from_object('config.config') app.config.from_object('env.env') #overwrites config.config for production server app.config.from_object('env.email') #overwrites config.config for production server +install_dir = os.path.split(os.path.realpath(__file__))[0] # Setup mail extension mail = Mail(app) @@ -102,6 +103,10 @@ def async_security_email(msg): def index(): return render_template('index.html') +@app.route('/custom/') +def custom(filename): + return send_from_directory(os.path.join(install_dir, app.config['CUSTOM_STATIC_PATH']), filename) + @app.route('/profile') def profile(): if current_user.is_authenticated(): diff --git a/config/config.py b/config/config.py index 5370a25..3b75acb 100644 --- a/config/config.py +++ b/config/config.py @@ -14,3 +14,4 @@ SECURITY_FORGOT_PASSWORD_TEMPLATE = 'security/reset.html' SECURITY_CHANGE_PASSWORD_TEMPLATE = 'security/change.html' PRODUCTION = False +CUSTOM_STATIC_PATH = 'custom' \ No newline at end of file diff --git a/static/custom.js b/custom/custom.js similarity index 100% rename from static/custom.js rename to custom/custom.js diff --git a/static/style.css b/custom/style.css similarity index 100% rename from static/style.css rename to custom/style.css diff --git a/templates/index.html b/templates/index.html index 9d2325f..3d774be 100644 --- a/templates/index.html +++ b/templates/index.html @@ -9,6 +9,6 @@ {% include "_scripts.html" %} - + {% endblock %} \ No newline at end of file diff --git a/templates/layout.html b/templates/layout.html index ce49a72..0767bdf 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -7,7 +7,7 @@ {% else %} {% endif %} - +