Richard Jones avatar Richard Jones committed 325273d

reinstate pages

Comments (0)

Files changed (3)

pyweek/README.txt

+How to set up a PyWeek-like site:
+
+1. install requirements.txt
+2. either use pyweek/*.py as your site's configuration or somehow merge it with
+   your own.
+3. create a local settings file pointed to by DJANGO_LOCAL_SETTINGS
+   - most notably you will need to set the MEDIA_* and STATIC_* variables, and
+     the database etc.
+
+Collect the static files:
+
+DJANGO_LOCAL_SETTINGS=path/to/pyweek-local-settings.py python -m pyweek.manage collectstatic

pyweek/challenge/urls.py

     (r'^all_awards/$', 'view_all_awards'),
 )
 
+urlpatterns += patterns('pyweek.challenge.views.pages',
+    (r'^s/(\w+)/$', 'page'),
+)

pyweek/challenge/views/pages.py

+import os, sets, cgi, urllib
+import datetime
+import xml.sax.saxutils
+
+from PIL import Image
+
+from django.shortcuts import render_to_response
+from django.template import RequestContext
+from pyweek.settings import PAGES_DIR
+from django.http import Http404
+
+from stripogram import html2text, html2safehtml
+
+def page(request, page_id):
+    path = os.path.join(PAGES_DIR, '%s.html'%page_id)
+    if not os.path.exists(path):
+        raise Http404('No file called %s'%page_id)
+    content = open(path, 'r').read()
+    return render_to_response('page.html',
+        dict(content=content), context_instance=RequestContext(request))
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.