Skip to content

Commit

Permalink
changed static tructure
Browse files Browse the repository at this point in the history
  • Loading branch information
jvsteiner committed Nov 5, 2014
1 parent 57f02d2 commit 8c387ab
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
!env/env.py.example
.DS_Store
7 changes: 6 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
@@ -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 *
Expand All @@ -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)
Expand Down Expand Up @@ -102,6 +103,10 @@ def async_security_email(msg):
def index():
return render_template('index.html')

@app.route('/custom/<path:filename>')
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():
Expand Down
1 change: 1 addition & 0 deletions config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
SECURITY_FORGOT_PASSWORD_TEMPLATE = 'security/reset.html'
SECURITY_CHANGE_PASSWORD_TEMPLATE = 'security/change.html'
PRODUCTION = False
CUSTOM_STATIC_PATH = 'custom'
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
</div>
<body>
{% include "_scripts.html" %}
<script src="{{ url_for('static', filename='custom.js') }}"></script>
<script src="{{ url_for('custom', filename='custom.js') }}"></script>
</body>
{% endblock %}
2 changes: 1 addition & 1 deletion templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% else %}
<link href="{{ url_for('static', filename='bootstrap.min.css') }}" rel="stylesheet">
{% endif %}
<link href="{{ url_for('static', filename='style.css') }}" rel="stylesheet">
<link href="{{ url_for('custom', filename='style.css') }}" rel="stylesheet">
</head>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
Expand Down

0 comments on commit 8c387ab

Please sign in to comment.