d
Size: a a a
d
d
RC
JW
import os
from crax import Crax
from crax.urls import Url, Route
from crax.views import TemplateView
class Home(TemplateView):
template = 'home.html'
class Docs(TemplateView):
template = 'index.html'
scope = os.listdir('crax_docs/templates')
class NotFoundHandler(TemplateView):
template = '404.html'
async def get(self):
self.status_code = 404
class ServerErrorHandler(TemplateView):
template = '500.html'
BASE_URL = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
URL_PATTERNS = [
Route(Url('/'), Home),
Route(urls=(
Url('/documentation', masquerade=True),
Url('/documentation/_sources/', masquerade=True)),
handler=Docs),
]
DISABLE_LOGS = False
ERROR_HANDLERS = {'404_handler': NotFoundHandler, '500_handler': ServerErrorHandler}
APPLICATIONS = ['crax_docs']
app = Crax(settings="crax_docs.app")
JW
RC
RC
RC
JW
RC
RC
d
d
RC
d
RC
RC
JW
JW
HTTP/1.1 201 Created
content-length: 15
content-type: application/json; charset=utf-8
date: Mon, 31 Aug 2020 20:18:28 GMT
server: uvicorn
{
"hui": "pizda"
}
RC
HTTP/1.1 201 Created
content-length: 15
content-type: application/json; charset=utf-8
date: Mon, 31 Aug 2020 20:18:28 GMT
server: uvicorn
{
"hui": "pizda"
}