Package: django-apiblueprint-view
django-apiblueprint-viewRenderAPI Blueprintson-the-fly using Django templatesInstallationpip install django-apiblueprint-viewAdd toINSTALLED_APPSin django settings:INSTALLED_APPS=[...'apiblueprint_view',]Usagefromapiblueprint_view.viewsimportApiBlueprintViewurlpatterns=[url(r'^docs/$',ApiBlueprintView.as_view(blueprint='/path/to/blueprint.apibp')),]StylingCustom HTML TemplateDefine a custom base template. It must include the tag{% include 'api_docs/docs_parent.html' %}Pass it intoApiBlueprintView.as_view()as a parameter.fromapiblueprint_view.viewsimportApiBlueprintViewurlpatterns=[url(r'^docs/$',ApiBlueprintView.as_view(blueprint='/path/to/blueprint.apibp',template_name='my_base_template.html')),]Custom CSSApiBlueprintView.as_view()may accept astylesdictionary describing custom CSS classes which should be attached to rendered HTML tags. For example:fromapiblueprint_view.viewsimportApiBlueprintViewurlpatterns=[url(r'^docs/$',ApiBlueprintView.as_view(blueprint='/path/to/blueprint.apibp',template_name='my_base_template.html',styles={'action':{'class':'foo bar'},'method':{'class':'baz'}})),]The following keys are valid. All keys are optional:'action': Container<div>for an API action'action_transaction': Container<div>for a HTTP transaction (request and response)'action_request': Container<div>for a HTTP request'action_response': Container<div>for a HTTP response'action_schema': Container<div>for a HTTP request or response schema'action_headers': Container<div>for HTTP request or response headers'action_body': Container<div>for a HTTP request or response body'action_example': Container<div>for an API action example URL'description': Container<div>for some text describing an action, resource, request, response, etc'parameters': Container<div>for a list of parameters'method': Generic<span>containing an HTTP method'method_CONNECT':<span>containing the textCONNECT'method_DELETE':<span>containing the textDELETE'method_GET':<span>containing the textGET'method_HEAD':<span>containing the textHEAD'method_OPTIONS':<span>containing the textOPTIONS'method_PATCH':<span>containing the textPATCH'method_POST':<span>containing the textPOST'method_PUT':<span>containing the textPUT'method_TRACE':<span>containing the textTRACE'resource': Container<div>for an API resource'resource_group': Container<div>for an API resource groupHighlight.jscan be used to add syntax highlightingIncluding FilesYou can include other files in your blueprint by using an include directive with a path to the included file relative to the current file's directory. Included files can include other files, so be careful of circular references.<!-- include(filename.md) -->This syntax is not a part of the API Blueprint spec, but is also supported in some other tools e.g:aglio.The include directive has the potential to introduce remote file inclusion or directory traversal vulnerabilities if your application renders user-supplied content. There are a couple of settings to help mitigate this. SetAPIBP_PROCESS_INCLUDES = Falsein your django settings to completely ignore include directives (the default isTrue). There is also a whitelist of allowed file types to include. The default whitelist is['.md', '.apibp', '.json']but this can be overridden by settingAPIBP_INCLUDE_WHITELISTto a list of allowed extensions in your django settings.