Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/whitenoise #473

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ media/
federated-analytics.js
*.conf
lrs/celery.py
*.ini
*.ini
staticfiles/*
7 changes: 6 additions & 1 deletion adl_lrs/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Root of LRS
SETTINGS_DIR = dirname(abspath(__file__))
PROJECT_ROOT = dirname(dirname(SETTINGS_DIR))
BASE_DIR = path.join(SETTINGS_DIR, '..')

config = RawConfigParser()
config.read(SETTINGS_DIR+'/settings.ini')
Expand Down Expand Up @@ -86,7 +87,7 @@
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
STATIC_ROOT = path.join(BASE_DIR, 'staticfiles')

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
Expand Down Expand Up @@ -181,6 +182,8 @@
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

# Make this unique, and don't share it with anybody.
SECRET_KEY = config.get('secrets', 'SECRET_KEY')

Expand Down Expand Up @@ -238,6 +241,7 @@
)

MIDDLEWARE_CLASSES = (
'whitenoise.middleware.WhiteNoiseMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
Expand All @@ -261,6 +265,7 @@
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'whitenoise.runserver_nostatic',
'django.contrib.staticfiles',
'adl_lrs',
'lrs',
Expand Down
11 changes: 6 additions & 5 deletions adl_lrs/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
{% load static from staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="ADL's open LRS">

<link rel="shortcut icon" href="{{ STATIC_URL }}img/favicon.ico" />
<link rel="icon" href="{{ STATIC_URL }}img/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="{% static "img/favicon.ico" %}" />
<link rel="icon" href="{% static "img/favicon.ico" %}" type="image/x-icon">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/pure-min.css">

<!--[if lte IE 8]>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-responsive-old-ie-min.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/marketing-old-ie.css">
<link rel="stylesheet" href="{% static "css/marketing-old-ie.css" %}">
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-responsive-min.css">
<link rel="stylesheet" href="{{ STATIC_URL }}css/marketing.css">
<link rel="stylesheet" href="{% static "css/marketing.css" %}">
<!--<![endif]-->
{% block extra_css %}{% endblock extra_css %}
<title>{% block title %}ADL LRS{% endblock title %}</title>
Expand Down Expand Up @@ -50,4 +51,4 @@
{% block content %}{% endblock content %}
{% block extra_js %}{% endblock extra_js %}
</body>
</html>
</html>
6 changes: 4 additions & 2 deletions adl_lrs/templates/home.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block extra_css %}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<style>
Expand Down Expand Up @@ -165,8 +167,8 @@ <h4>More Information</h4>
</div>
</div>
<div class="footer l-box is-center">
<img class="brand" height="35" width="55" src="{{ STATIC_URL }}img/adllogo.png" alt="experience api logo"/> Advanced Distributed Learning
<img class="brand" height="35" width="55" src="{% static "img/adllogo.png" %}" alt="experience api logo"/> Advanced Distributed Learning
<p>This is an official website of the U.S. Government &copy; Advanced Distributed Learning</p>
</div>
</div>
{% endblock content %}
{% endblock content %}
8 changes: 5 additions & 3 deletions adl_lrs/templates/me.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{% extends "base.html" %}
{% load static from staticfiles %}
{% load jsonify %}

{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block title %}{{user.username}}'s Account{% endblock title %}
{% block heading %}{{user.username}}'s Account{% endblock heading %}
Expand Down Expand Up @@ -95,7 +97,7 @@ <h4 class="email-subject">
{% endblock content %}
{% block extra_js %}
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}scripts/extra-menu.js"></script>
<script type="text/javascript" src="{% static "scripts/extra-menu.js" %}"></script>
<script type="text/javascript">
$(document).ready(function() {
// These events stay inline so urls render correctly
Expand Down Expand Up @@ -152,4 +154,4 @@ <h4 class="email-subject">
});
});
</script>
{% endblock extra_js %}
{% endblock extra_js %}
8 changes: 5 additions & 3 deletions adl_lrs/templates/my_activity_states.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
<style>
pre {
white-space: pre-wrap; /* CSS 3 */
Expand Down Expand Up @@ -114,5 +116,5 @@ <h5 class="email-subject"><i>Last Updated: {{ as.updated }}</i></h5>
});
}
</script>
<script type="text/javascript" src="{{ STATIC_URL }}scripts/extra-data.js"></script>
{% endblock extra_js %}
<script type="text/javascript" src="{% static "scripts/extra-data.js" %}"></script>
{% endblock extra_js %}
5 changes: 3 additions & 2 deletions adl_lrs/templates/my_hooks.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% extends "base.html" %}
{% load static from staticfiles %}
{% load jsonify %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block title %}{{user.username}}'s Hooks{% endblock title %}
{% block heading %}{{user.username}}'s Hooks{% endblock heading %}
Expand Down Expand Up @@ -113,4 +114,4 @@ <h3>Webhook Registration</h3>
});
});
</script>
{% endblock extra_js %}
{% endblock extra_js %}
6 changes: 4 additions & 2 deletions adl_lrs/templates/my_statements.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{% extends "base.html" %}
{% load static from staticfiles %}
{% load jsonify %}

{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
<style>
pre {
white-space: pre-wrap; /* CSS 3 */
Expand Down Expand Up @@ -79,5 +81,5 @@ <h5 class="email-subject">{{ stmt.statement_id }}</h5>
{% endblock content %}
{% block extra_js %}
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}scripts/extra-data.js"></script>
<script type="text/javascript" src="{% static "scripts/extra-data.js" %}"></script>
{% endblock extra_js %}
8 changes: 5 additions & 3 deletions adl_lrs/templates/oauth_authorize_client.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}Application Access Approval{% endblock title %}
{% block heading %}Application Access Approval{% endblock heading %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block content %}
<br>
Expand Down Expand Up @@ -54,5 +56,5 @@ <h3 class="content-subhead">Application Access Approval</h3>
});
});
</script>
<script type="text/javascript" src="{{ STATIC_URL }}scripts/extra-forms.js"></script>
{% endblock extra_js %}
<script type="text/javascript" src="{% static "scripts/extra-forms.js" %}"></script>
{% endblock extra_js %}
6 changes: 4 additions & 2 deletions adl_lrs/templates/oauth_verifier_pin.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}ADL LRS Client Allow Access{% endblock title %}
{% block heading %}ADL LRS Client Allow Access{% endblock heading %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block content %}
<br>
Expand All @@ -20,4 +22,4 @@
<div class="l-box pure-u-1 pure-u-md-1-3 pure-u-lg-1-3"></div>
</div>
</div>
{% endblock content %}
{% endblock content %}
8 changes: 5 additions & 3 deletions adl_lrs/templates/regclient.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}ADL LRS Client Registration{% endblock title %}
{% block heading %}ADL LRS Client Registration{% endblock heading %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block content %}
<br>
Expand Down Expand Up @@ -54,5 +56,5 @@ <h3 class="content-subhead">OAuth Client Registration</h3>
{% endblock content %}
{% block extra_js %}
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}scripts/extra-forms.js"></script>
{% endblock extra_js %}
<script type="text/javascript" src="{% static "scripts/extra-forms.js" %}"></script>
{% endblock extra_js %}
6 changes: 4 additions & 2 deletions adl_lrs/templates/register.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}ADL LRS Registration{% endblock title %}
{% block heading %}ADL LRS Registration{% endblock heading %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block content %}
<br>
Expand Down Expand Up @@ -46,4 +48,4 @@ <h3 class="content-subhead">User Registration</h3>
<div class="l-box pure-u-1 pure-u-md-1-3 pure-u-lg-1-3"></div>
</div>
</div>
{% endblock content %}
{% endblock content %}
6 changes: 4 additions & 2 deletions adl_lrs/templates/registration/login.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}ADL LRS Login{% endblock title %}
{% block heading %}ADL LRS Login{% endblock heading %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block content %}
<br>
Expand Down Expand Up @@ -34,4 +36,4 @@ <h3 class="content-subhead">LRS Login</h3>
<div class="l-box pure-u-1 pure-u-md-1-3 pure-u-lg-1-3"></div>
</div>
</div>
{% endblock content %}
{% endblock content %}
6 changes: 4 additions & 2 deletions adl_lrs/templates/registration/password_reset_complete.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}ADL LRS Reset Complete{% endblock title %}
{% block heading %}ADL LRS Reset Complete{% endblock heading %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block content %}
<br>
Expand All @@ -17,4 +19,4 @@ <h3 class="content-subhead">LRS Password Reset Complete</h3>
<div class="l-box pure-u-1 pure-u-md-1-3 pure-u-lg-1-3"></div>
</div>
</div>
{% endblock content %}
{% endblock content %}
6 changes: 4 additions & 2 deletions adl_lrs/templates/registration/password_reset_confirm.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}ADL LRS Reset Confirmation{% endblock title %}
{% block heading %}ADL LRS Reset Confirmation{% endblock heading %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block content %}
<br>
Expand Down Expand Up @@ -35,4 +37,4 @@ <h4>Password reset unsuccessful</h4>
<div class="l-box pure-u-1 pure-u-md-1-3 pure-u-lg-1-3"></div>
</div>
</div>
{% endblock content %}
{% endblock content %}
6 changes: 4 additions & 2 deletions adl_lrs/templates/registration/password_reset_done.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}ADL LRS Reset Successful{% endblock title %}
{% block heading %}ADL LRS Reset Successful{% endblock heading %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block content %}
<br>
Expand All @@ -16,4 +18,4 @@ <h3 class="content-subhead">LRS Password Reset</h3>
<div class="l-box pure-u-1 pure-u-md-1-3 pure-u-lg-1-3"></div>
</div>
</div>
{% endblock content %}
{% endblock content %}
6 changes: 4 additions & 2 deletions adl_lrs/templates/registration/password_reset_form.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}ADL LRS Reset{% endblock title %}
{% block heading %}ADL LRS Reset{% endblock heading %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}>
{% endblock extra_css %}
{% block content %}
<br>
Expand All @@ -26,4 +28,4 @@ <h3 class="content-subhead">LRS Password Reset</h3>
<div class="l-box pure-u-1 pure-u-md-1-3 pure-u-lg-1-3"></div>
</div>
</div>
{% endblock content %}
{% endblock content %}
6 changes: 4 additions & 2 deletions adl_lrs/templates/validator.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{% extends "base.html" %}
{% load static from staticfiles %}

{% block title %}ADL LRS xAPI Statement Validator{% endblock title %}
{% block extra_css %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/extra.css">
<link rel="stylesheet" href="{% static "css/extra.css" %}">
{% endblock extra_css %}
{% block content %}
<br>
Expand Down Expand Up @@ -37,4 +39,4 @@ <h1 class="content-subhead">xAPI Statement Validator</h1>
</div>
</div>
</div>
{% endblock content %}
{% endblock content %}
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ pytz==2015.7
requests==2.9.1
rfc3987==1.3.4
supervisor==3.2.0
whitenoise==3.3.0
Empty file added staticfiles/.ignoreme
Empty file.