Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Added external libraries using bower and configured routes in template file

tranbennya51a6f162859
diff --git a/.bowerrc b/.bowerrc
new file mode 100644
index 000000000..cd2f50bec
--- /dev/null
+++ b/.bowerrc
@@ -0,0 +1,3 @@
+{
+ "directory" : "/wger/core/static/bower_components"
+}
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index b3b3eb380..aa26ab3a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,3 +58,6 @@ target/
# IDE
.idea/
+
+# External Libraries
+wger/core/static/bower_components
diff --git a/requirements.txt b/requirements.txt
index 1cafc5432..6d0945b8a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -16,6 +16,7 @@ icalendar
django-bootstrap-breadcrumbs
sphinx
django-sortedm2m
+django-bower
# REST API
djangorestframework>=3.1,<3.2
@@ -24,4 +25,4 @@ django-tastypie
django-cors-headers
# Python3 compatibility
-six
+six
\ No newline at end of file
diff --git a/wger/core/templates/template.html b/wger/core/templates/template.html
index 7ed5ec132..b7adc515b 100644
--- a/wger/core/templates/template.html
+++ b/wger/core/templates/template.html
@@ -47,24 +47,24 @@
{% compress css %}
<link rel="stylesheet" type="text/css" href="{% static 'css/workout-manager.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/workout-manager-common.css' %}">
- <link rel="stylesheet" type="text/css" href="{% static 'css/jquery-ui.css' %}">
+ <link rel="stylesheet" type="text/css" href="{% static 'bower_components/jquery-ui/themes/smoothness/jquery-ui.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/jquery-ui-custom.css' %}">
- <link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap.min.css' %}">
+ <link rel="stylesheet" type="text/css" href="{% static 'bower_components/bootstrap/dist/css/bootstrap.min.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'css/bootstrap-custom.css' %}">
- <link rel="stylesheet" type="text/css" href="{% static 'css/datepicker3.css' %}">
- <link rel="stylesheet" type="text/css" href="{% static 'css/shariff.min.css' %}">
+ <link rel="stylesheet" type="text/css" href="{% static 'bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css' %}">
+ <link rel="stylesheet" type="text/css" href="{% static 'bower_components/shariff/build/shariff.min.css' %}">
{% endcompress %}
<link rel="icon" href="{% static 'images/favicon.png' %}" type="image/png">
{% compress js %}
- <script src="{% static 'js/jquery.js' %}"></script>
- <script src="{% static 'js/jquery-ui.js' %}"></script>
- <script src="{% static 'js/d3.js' %}"></script>
+ <script src="{% static 'bower_components/jquery/dist/jquery.js' %}"></script>
+ <script src="{% static 'bower_components/jquery-ui/jquery-ui.js' %}"></script>
+ <script src="{% static 'bower_components/d3/d3.js' %}"></script>
<script src="{% static 'js/workout-manager.js' %}"></script>
<script src="{% static 'js/ubuntu-unity.js' %}"></script>
- <script src="{% static 'js/bootstrap.min.js' %}"></script>
- <script src="{% static 'js/bootstrap-datepicker/bootstrap-datepicker.min.js' %}"></script>
+ <script src="{% static 'bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
+ <script src="{% static 'bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js' %}"></script>
<script src="{% static 'js/exercises.js' %}"></script>
<script src="{% static 'js/weight.js' %}"></script>
<script src="{% static 'js/nutrition.js' %}"></script>
@@ -219,7 +219,7 @@
</div>
</footer>
-<script src="{% static 'js/shariff.min.js' %}"></script>
+<script src="{% static 'bower_components/shariff/build/shariff.min.js' %}"></script>
</body>
{% endspaceless_config %}
</html>
diff --git a/wger/settings_global.py b/wger/settings_global.py
index e74e93bab..637d15429 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -85,8 +85,23 @@ INSTALLED_APPS = (
# CORS
'corsheaders',
+
+ #django-bower JS libraries automation
+ 'djangobower',
+)
+
+BOWER_INSTALLED_APPS = (
+ 'jquery',
+ 'bootstrap',
+ 'jquery-ui',
+ 'bootstrap-datepicker',
+ 'd3',
+ 'shariff',
+ 'tinymce-dist',
+ 'DataTables',
)
+
MIDDLEWARE_CLASSES = (
'corsheaders.middleware.CorsMiddleware',
'django.middleware.common.CommonMiddleware',
@@ -143,6 +158,7 @@ MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+ 'djangobower.finders.BowerFinder',
# Django compressor
'compressor.finders.CompressorFinder',
@@ -281,6 +297,9 @@ STATIC_URL = '/static/'
# COMPRESS_ENABLED = True
COMPRESS_ROOT = STATIC_ROOT
+# BOWER components route
+BOWER_COMPONENTS_ROUTE = os.path.join(STATIC_ROOT, 'components')
+
#
# Django Rest Framework