Skip to content

Commit 3b1e438

Browse files
committed
Add UKPA 2017-8 annual report
1 parent b9d8489 commit 3b1e438

5 files changed

Lines changed: 40 additions & 1 deletion

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
title: UKPA Trustees Annual Report 2017-8
2+
newsletter_month: 2018-09
3+
---
4+
The UK Python Association trustees are pleased to publish their [annual report for 2017-8](/static/pdfs/ukpa-annual-reports/UKPA_Trustees_Annual_Report_2017.pdf).
5+
6+
The annual report will be discussed at the UKPA AGM at PyCon UK.
Binary file not shown.

‎ukpython/settings.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
STATIC_URL = '/static/'
106106
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
107107
STATICFILES_DIRS = [
108-
os.path.join(BASE_DIR, 'media')
108+
os.path.join(BASE_DIR, 'static')
109109
]
110110
STATICFILES_FINDERS = (
111111
'django.contrib.staticfiles.finders.FileSystemFinder',

‎ukpython/urls.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
url(r'news/$', views.news, name='news'),
1212
url(r'news/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[\w-]+)/$', views.news_item, name='news-item'),
1313
url(r'^(?P<key>.*?)/$', views.page_view, name='page'),
14+
url(r'^static/(?P<path>.*)$', views.serve_static),
1415
]

‎ukpython/views.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import calendar
22
import datetime
3+
import os
4+
import posixpath
35

6+
from django.contrib.staticfiles import finders
7+
from django.http import Http404
48
from django.shortcuts import render
9+
from django.utils.six.moves.urllib.parse import unquote
10+
from django.views import static
511

612
from .models import Event, NewsItem, Page, UserGroup
713

@@ -73,3 +79,29 @@ def news_item(request, year, month, day, slug):
7379
'news_item': news_item,
7480
}
7581
return render(request, 'ukpython/news_item.html', context)
82+
83+
84+
def serve_static(request, path, insecure=False, **kwargs):
85+
"""
86+
This is copied from Django's contrib.staticfiles.views to remove the DEBUG
87+
check.
88+
89+
We don't need to check DEBUG since we never actually serve the site with
90+
Django.
91+
92+
Serve static files below a given point in the directory structure or
93+
from locations inferred from the staticfiles finders.
94+
To use, put a URL pattern such as::
95+
from django.contrib.staticfiles import views
96+
url(r'^(?P<path>.*)$', views.serve)
97+
in your URLconf.
98+
It uses the django.views.static.serve() view to serve the found files.
99+
"""
100+
normalized_path = posixpath.normpath(unquote(path)).lstrip('/')
101+
absolute_path = finders.find(normalized_path)
102+
if not absolute_path:
103+
if path.endswith('/') or path == '':
104+
raise Http404("Directory indexes are not allowed here.")
105+
raise Http404("'%s' could not be found" % path)
106+
document_root, path = os.path.split(absolute_path)
107+
return static.serve(request, path, document_root=document_root, **kwargs)

0 commit comments

Comments
 (0)