def ExportToDjangoView(request):
if '<STR_LIT>' in os.environ:<EOL><INDENT>registry = prometheus_client.CollectorRegistry()<EOL>multiprocess.MultiProcessCollector(registry)<EOL><DEDENT>else:<EOL><INDENT>registry = prometheus_client.REGISTRY<EOL><DEDENT>metrics_page = prometheus_client.generate_latest(registry)<EOL>return HttpResponse(<EOL>metrics_page,<EOL>content_type=prometheus_client.CONTENT_TYPE_LATEST)<EOL>
Exports /metrics as a Django view.

    You can use django_prometheus.urls to map /metrics to this view.