diff --git a/.gitignore b/.gitignore index d1788aba..18c39c2e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ +# database +*.sqlite3 + # python *.pyc -# database -*.sqlite3 \ No newline at end of file +# static files +babyblotter/static \ No newline at end of file diff --git a/Pipfile b/Pipfile index 6c028281..cccf5ddf 100644 --- a/Pipfile +++ b/Pipfile @@ -6,3 +6,5 @@ url = "https://pypi.python.org/simple" django = "*" djangorestframework = "*" django-filter = "*" +django-angular = "*" +whitenoise = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 8d6b5c62..19515d7b 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "a0ef885217179eed1565af7ec6a732e8b141fb42c156f152380a65feac7cb1fe" + "sha256": "58ee3f51b748a5b05db80eda5a1885ac84e5645f540c5d67a00555a2b1156cc1" }, "requires": {}, "sources": [ @@ -15,6 +15,9 @@ "django": { "version": "==1.11.4" }, + "django-angular": { + "version": "==1.0.2" + }, "django-filter": { "version": "==1.0.4" }, @@ -23,6 +26,9 @@ }, "pytz": { "version": "==2017.2" + }, + "whitenoise": { + "version": "==3.3.0" } }, "develop": {} diff --git a/babyblotter/settings.py b/babyblotter/settings.py index c55c5be4..26de0927 100644 --- a/babyblotter/settings.py +++ b/babyblotter/settings.py @@ -22,6 +22,7 @@ INSTALLED_APPS = [ 'api', 'core', + 'djng', 'rest_framework', 'django.contrib.admin', @@ -34,6 +35,9 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', + + 'whitenoise.middleware.WhiteNoiseMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -91,8 +95,22 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.11/howto/static-files/ +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' + +STATICFILES_FINDERS = [ + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +] + STATIC_URL = '/static/' +STATIC_ROOT = os.path.join(BASE_DIR, 'babyblotter/static') + + +# Form rendering +# https://docs.djangoproject.com/en/1.11/ref/settings/#form-renderer +FORM_RENDERER = 'djng.forms.renderers.DjangoAngularBootstrap3Templates' + # Django Rest Framework # http://www.django-rest-framework.org/#