-
-
Notifications
You must be signed in to change notification settings - Fork 354
Closed
Labels
Description
I'm trying to profile a api of this project. I had followed the instructions of the readme of django-silk, but the profiling page was empty, though i could see files generated under profiles directory which i configured.
The project's address is https://github.com/bluven/py-perf, it's a simple project, the method i profiled is api/views/UserViewSet.list
settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'silk'
]
MIDDLEWARE = [
'silk.middleware.SilkyMiddleware',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
]
SILKY_PYTHON_PROFILER = True
SILKY_PYTHON_PROFILER_BINARY = True
SILKY_PYTHON_PROFILER_RESULT_PATH = os.path.join(BASE_DIR, "profiles")
api/views.py
class UserViewSet(ModelViewSet):
queryset = User.objects.all()
serializer_class = UserSerializer
lookup_field = 'username'
@silk_profile()
def list(self, request, *args, **kwargs):
print('*')
return super(UserViewSet, self).list(request, *args, **kwargs)Thanks in advance.
katichev, laiyijie, mbeacom, timthelion, denti and 12 more