Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
Update Inside Gratipay to work with Aspen 0.42
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Dec 5, 2016
1 parent 79705b0 commit 3d10ed1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
7 changes: 6 additions & 1 deletion inside_gratipay.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import os
import string
import random
from os.path import basename, dirname, join, realpath, isdir
from os.path import basename, dirname

from aspen import Response
from aspen.website import Website

import canonizer
import gfm
from nav import NavItem


website = Website(www_root='www', project_root='.')


# Manually register markdown renderer to work around Heroku deployment woes.
website.renderer_factories['markdown'] = gfm.Factory(website)
website.renderer_factories['jinja2'].Renderer.global_context = {
Expand Down
4 changes: 2 additions & 2 deletions nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from os.path import join, realpath, isfile, isdir, basename

from aspen import resources
from aspen.resources.static_resource import StaticResource
from aspen.http.resource import Static


def get_simplate_context(website, fs):
resource = resources.get(website, fs)
return {} if isinstance(resource, StaticResource) else resource.pages[0]
return {} if isinstance(resource, Static) else resource.pages[0]


class NavItem(OrderedDict):
Expand Down
19 changes: 6 additions & 13 deletions startapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,18 @@
PORT = 8536 # default/devserver port

import sys
from aspen.website import Website

aspen_config = [
'--www_root=www/',
'--project_root=.'
]


for param in sys.argv:
if param.startswith('--port'):
_, PORT = param.split('=')
PORT = int(PORT)


# by WSGI convention, we need to create webapp object
# and by default most WSGI servers look for 'application'
application = Website(aspen_config)
from inside_gratipay import website as application

if __name__ == '__main__':
from wsgiref.simple_server import make_server
print("* Running development server on http://%s:%s" % (HOST, PORT))
print("* Running development server on http://%s:%s" % (HOST or 'localhost', PORT))
make_server(HOST, PORT, application).serve_forever()

0 comments on commit 3d10ed1

Please sign in to comment.