Add a basic demo page

This commit is contained in:
Srijan Choudhary 2014-04-24 01:22:30 +05:30
parent 087b9e98ff
commit cb0acc5ac0
3 changed files with 24 additions and 2 deletions

View File

@ -180,7 +180,9 @@ def make_app(conf=None, threading=True, multiprocessing=False, uwsgi=False):
wrapper.append(partial(SharedDataMiddleware, exports={
'/js': join(dirname(__file__), 'js/'),
'/css': join(dirname(__file__), 'css/')}))
'/css': join(dirname(__file__), 'css/'),
'/demo': join(dirname(__file__), 'demo/')
}))
wrapper.append(partial(wsgi.CORSMiddleware,
origin=origin(isso.conf.getiter("general", "host")),

14
isso/demo/index.html Normal file
View File

@ -0,0 +1,14 @@
<head>
<title>Isso Demo</title>
</head>
<body>
<div id="page" style="text-align:center;">
<div id="wrapper" style="width: 900px; text-align: left; margin-left: auto; margin-right: auto;">
<h2><a href="index.html">Isso Demo</a></h2>
<script src="../js/embed.min.js"></script>
<section id="isso-thread" data-title="Isso Test"></section>
</div>
</div>
</body>

View File

@ -12,6 +12,8 @@ from werkzeug.http import dump_cookie
from werkzeug.routing import Rule
from werkzeug.wrappers import Response
from werkzeug.exceptions import BadRequest, Forbidden, NotFound
from werkzeug.wsgi import get_current_url
from werkzeug.utils import redirect
from isso.compat import text_type as str
@ -69,7 +71,8 @@ class API(object):
('moderate',('POST', '/id/<int:id>/<any(activate,delete):action>/<string:key>')),
('like', ('POST', '/id/<int:id>/like')),
('dislike', ('POST', '/id/<int:id>/dislike')),
('checkip', ('GET', '/check-ip'))
('checkip', ('GET', '/check-ip')),
('demo', ('GET', '/demo'))
]
def __init__(self, isso):
@ -375,3 +378,6 @@ class API(object):
def checkip(self, env, req):
return Response(utils.anonymize(str(req.remote_addr)), 200)
def demo(self, env, req):
return redirect(get_current_url(env) + '/index.html')