You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/08/10 14:26:23 UTC

[GitHub] [skywalking] alonelaval commented on issue #5285: skywalking-python not trace request

alonelaval commented on issue #5285:
URL: https://github.com/apache/skywalking/issues/5285#issuecomment-671387976


   I tested Django==3.1, apache-skywalking==0.2.0.  it worked well
   ```
   import sys
   import time
   
   from skywalking import agent, config
   
   from django.conf import settings
   from django.conf.urls import url
   from django.http import JsonResponse
   
   
   config.service_name = "provider"
   config.logging_level = "DEBUG"
   agent.start()
   
   
   settings.configure(
       DEBUG=True,
       ROOT_URLCONF=__name__,
       ALLOWED_HOSTS=['*'],
   )
   
   
   def index(request):
       time.sleep(0.5)
       return JsonResponse({"song": "Despacito", "artist": "Luis Fonsi"})
   
   
   urlpatterns = (
       url("users", index),
   )
   
   
   if __name__ == "__main__":
       from django.core.management import execute_from_command_line
   
       execute_from_command_line(sys.argv)
   ```
   cmd: python3 test_django.py runserver 0.0.0.0:9090
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org