⌈⌋ branch:  Bitrhythm


Artifact Content

Artifact 68f5584a5fbc9c109d919b91e993d315cef99e6ce8210bf5a22482eeaeb0dc8c:

  • File bitrhythm.py — part of check-in [28d3f65371] at 2022-05-03 03:30:47 on branch trunk — Cleanup of requirements (user: dev size: 1140)

from sanic import Sanic, response
from sanic.response import json, text
from sanic.exceptions import NotFound 
from jinja2 import Environment, FileSystemLoader
import re
import ipdb
import sys
import traceback
import json
import datetime
from email.utils import format_datetime
from urllib.parse import urlparse
import base64
file_loader = FileSystemLoader('templates')
env = Environment(loader=file_loader)
app = Sanic('Bitrhythm')


@app.exception(NotFound)
async def ignore_404s(request, exception):
    return text('Yep, I totally found the page ' + request.url)


@app.route('/song/<name>')
async def get_index(request, name):
    template = env.get_template('index.html')
    return response.html(template.render({'data': name}))


@app.route('/')
async def get_index(request):
    template = env.get_template('index.html')
    return response.html(template.render({'data': ''}))


@app.route('/issue')
async def get_index(request):
    template = env.get_template('page.html')
    return response.html(template.render())


app.static('/', './public')
if __name__ == '__main__':
    import sys
    app.run(host='0.0.0.0', port=8015)