Skip to content

Commit a1bc215

Browse files
committed
Merge pull request #310 from mboersma/remove-static
ref(static): remove WSGI app and unused resources
2 parents 6c37d2e + bc7ea6f commit a1bc215

6 files changed

Lines changed: 12 additions & 97 deletions

File tree

rootfs/.coveragerc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ omit =
66
api/__init__.py
77
api/docker.py
88
scheduler/*
9-
web/__init__.py
10-
web/models.py
11-
web/templatetags/__init__.py
129
# osx library files when not running in virtualenv
1310
/Library/*
1411
/System/*
@@ -27,5 +24,4 @@ exclude_lines =
2724
if __name__ == .__main__.:
2825

2926
[html]
30-
extra_css = web/static/css/main.css
3127
title = Deis Coverage Report

rootfs/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,4 @@ RUN DOCKER_BUILD=true /app/tmp/build.sh && rm -rf /app/*
2828

2929
ADD . /app
3030

31-
RUN ./manage.py collectstatic --settings=deis.settings --noinput # create static resources
32-
3331
ENV DEIS_RELEASE 2.0.0-dev

rootfs/api/static/500.html

Lines changed: 0 additions & 35 deletions
This file was deleted.

rootfs/deis/settings.py

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -57,30 +57,10 @@
5757
# Examples: "http://example.com/media/", "http://media.example.com/"
5858
MEDIA_URL = ''
5959

60-
# Absolute path to the directory static files should be collected to.
61-
# Don't put anything in this directory yourself; store your static files
62-
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
63-
# Example: "/var/www/example.com/static/"
64-
STATIC_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', 'static'))
65-
66-
# URL prefix for static files.
67-
# Example: "http://example.com/static/", "http://static.example.com/"
60+
# Static files (CSS, JavaScript, Images)
61+
# https://docs.djangoproject.com/en/1.9/howto/static-files/
6862
STATIC_URL = '/static/'
6963

70-
# Additional locations of static files
71-
STATICFILES_DIRS = (
72-
# Put strings here, like "/home/html/static" or "C:/www/django/static".
73-
# Always use forward slashes, even on Windows.
74-
# Don't forget to use absolute paths, not relative paths.
75-
)
76-
77-
# List of finder classes that know how to find static files in
78-
# various locations.
79-
STATICFILES_FINDERS = (
80-
'django.contrib.staticfiles.finders.FileSystemFinder',
81-
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
82-
)
83-
8464
# Manage templates
8565
TEMPLATES = [
8666
{
@@ -96,7 +76,6 @@
9676
"django.template.context_processors.i18n",
9777
"django.template.context_processors.media",
9878
"django.template.context_processors.request",
99-
"django.template.context_processors.static",
10079
"django.template.context_processors.tz",
10180
"django.contrib.messages.context_processors.messages"
10281
],
@@ -106,8 +85,9 @@
10685

10786
MIDDLEWARE_CLASSES = (
10887
'corsheaders.middleware.CorsMiddleware',
109-
'django.middleware.common.CommonMiddleware',
88+
'django.middleware.security.SecurityMiddleware',
11089
'django.contrib.sessions.middleware.SessionMiddleware',
90+
'django.middleware.common.CommonMiddleware',
11191
'django.contrib.auth.middleware.AuthenticationMiddleware',
11292
'django.contrib.messages.middleware.MessageMiddleware',
11393
'django.contrib.sites.middleware.CurrentSiteMiddleware',
@@ -123,21 +103,19 @@
123103
WSGI_APPLICATION = 'deis.wsgi.application'
124104

125105
INSTALLED_APPS = (
126-
'django.contrib.admin',
127106
'django.contrib.auth',
128107
'django.contrib.contenttypes',
129108
'django.contrib.humanize',
130109
'django.contrib.messages',
131110
'django.contrib.sessions',
132111
'django.contrib.sites',
133-
'django.contrib.staticfiles',
134112
# Third-party apps
113+
'corsheaders',
135114
'guardian',
136-
'jsonfield',
137115
'gunicorn',
116+
'jsonfield',
138117
'rest_framework',
139118
'rest_framework.authtoken',
140-
'corsheaders',
141119
# Deis apps
142120
'api'
143121
)

rootfs/deis/wsgi.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,16 @@
11
"""
22
WSGI config for deis project.
33
4-
This module contains the WSGI application used by Django's development server
5-
and any production WSGI deployments. It should expose a module-level variable
6-
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
7-
this application via the ``WSGI_APPLICATION`` setting.
4+
It exposes the WSGI callable as a module-level variable named ``application``.
85
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
98
"""
109

1110
import os
1211

1312
from django.core.wsgi import get_wsgi_application
14-
import static
15-
1613

1714
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "deis.settings")
1815

19-
20-
class Dispatcher(object):
21-
"""
22-
Dispatches requests between two WSGI apps, a static file server and a
23-
Django server.
24-
"""
25-
26-
def __init__(self):
27-
self.django_handler = get_wsgi_application()
28-
self.static_handler = static.Cling(os.path.dirname(os.path.dirname(__file__)))
29-
30-
def __call__(self, environ, start_response):
31-
if environ['PATH_INFO'].startswith('/static'):
32-
return self.static_handler(environ, start_response)
33-
else:
34-
return self.django_handler(environ, start_response)
35-
36-
37-
application = Dispatcher()
16+
application = get_wsgi_application()

rootfs/requirements.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ Django==1.9.1
44
django-cors-headers==1.1.0
55
django-guardian==1.3.2
66
djangorestframework==3.3.2
7-
jsonfield==1.0.3
87
docker-py==1.6.0
98
gunicorn==19.4.1
9+
jsonfield==1.0.3
10+
morph==0.1.2
1011
psycopg2==2.6.1
1112
python-etcd==0.3.2
1213
PyYAML==3.11
1314
requests==2.9.1
1415
simpleflock==0.0.3
15-
static==1.1.1
16-
morph==0.1.2

0 commit comments

Comments
 (0)