Skip to content

Commit 795df91

Browse files
authored
Merge pull request hack4impact#49 from hack4impact/small-fixes
SECRET_KEY Assertion and Asset changes
2 parents 9369bf9 + af451cd commit 795df91

5 files changed

Lines changed: 39 additions & 10 deletions

File tree

app/assets.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@
1313
)
1414

1515
vendor_css = Bundle(
16-
'vendor/semantic.min.css',
16+
'vendor/*.css',
1717
output='styles/vendor.css'
1818
)
1919

2020
vendor_js = Bundle(
21-
'vendor/jquery.min.js',
22-
'vendor/semantic.min.js',
23-
'vendor/tablesort.min.js',
21+
'vendor/*.js',
2422
filters='jsmin',
2523
output='scripts/vendor.js'
2624
)

app/assets/scripts/vendor/zxcvbn.js

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/templates/main/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{% block content %}
44
<div class="ui text container">
5-
<h1>Hello, world</h1>
5+
<h1>Hello {% if not (current_user.is_authenticated()) %} world {% else %} {{ current_user.full_name() }} {% endif %},</h1>
66

77
<p>This is <a href="http://hack4impact.org">Hack4Impact</a>'s web application template. We'll use this as a
88
foundation for each of our <a href="http://flask.pocoo.org">Flask</a> projects. The goal is to reduce the work
@@ -14,4 +14,4 @@ <h1>Hello, world</h1>
1414

1515
<p>{{ lipsum(6) }}</p>
1616
</div>
17-
{% endblock %}
17+
{% endblock %}

config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66

77
class Config:
88
APP_NAME = 'Flask-Base'
9-
SECRET_KEY = os.environ.get('SECRET_KEY') or \
10-
'SjefBOa$1FgGco0SkfPO392qqH9%a492'
9+
if os.environ.get('SECRET_KEY'):
10+
SECRET_KEY = os.environ.get('SECRET_KEY')
11+
else:
12+
SECRET_KEY = 'SECRET_KEY_ENV_VAR_NOT_SET'
13+
print 'SECRET KEY ENV VAR NOT SET! SHOULD NOT SEE IN PRODUDCTION'
1114
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
1215

1316
MAIL_SERVER = 'smtp.googlemail.com'
@@ -60,7 +63,7 @@ class ProductionConfig(Config):
6063
@classmethod
6164
def init_app(cls, app):
6265
Config.init_app(app)
63-
66+
assert os.environ.get('SECRET_KEY'), 'SECRET_KEY IS NOT SET!'
6467
# Email errors to administators
6568
import logging
6669
from logging.handlers import SMTPHandler

manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
from flask.ext.migrate import Migrate, MigrateCommand
99

1010

11-
# Import settings from .env file. Must define FLASK_CONFIG
1211
if os.path.exists('.env'):
1312
print('Importing environment from .env file')
1413
for line in open('.env'):
1514
var = line.strip().split('=')
1615
if len(var) == 2:
1716
os.environ[var[0]] = var[1]
1817

18+
1919
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
2020
manager = Manager(app)
2121
migrate = Migrate(app, db)

0 commit comments

Comments
 (0)