Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silk profile is not work, with dango-version 2.0.2 and django-silk version 2.0.0 #277

Closed
laiyijie opened this issue Apr 20, 2018 · 5 comments

Comments

@laiyijie
Copy link

image
when I using the decorator in the view function like this:
image

and I also tried to set
SILKY_PYTHON_PROFILER = True
SILKY_PYTHON_PROFILER_BINARY = True
and the profile is not work at all
"No Silk profiling was performed for this request. Use the silk_profile decorator/context manager to do so."

@l-vincent-l
Copy link

I have the same issue, and no idea how to solve it.
Any help will be appreciated.

@danielbradburn
Copy link
Contributor

I am unable to replicate this issue, for example the test project in the silk repo works correctly under django 2.0.2

Perhaps you could try adding this to your settings.py to ensure the profiles can be correctly saved?

    SILKY_PYTHON_PROFILER_RESULT_PATH = os.path.join(BASE_DIR, '.profiles')
    with contextlib.suppress(OSError):
        os.makedirs(SILKY_PYTHON_PROFILER_RESULT_PATH)

@sur0g
Copy link

sur0g commented May 7, 2018

For Django==2.0.2 and django-silk==2.0.0.
I've done some research with this issue and found some error in lib\site-packages\silk\collector.py. It uses direct assignment to one of the class attributes though it's forbidden in ***\Lib\site-packages\django\db\models\fields\related_descriptors.py directly:

def __set__(self, instance, value):
	raise TypeError(
		'Direct assignment to the %s is prohibited. Use %s.set() instead.'
		% self._get_set_deprecation_msg_params(),
	)

It helps if I change the row 183 of lib\site-packages\silk\collector.py to

profile.queries.set(profile_query_models)

@albertyw
Copy link
Member

albertyw commented May 7, 2018

That was fixed in #275. I think it's time to make a new release. @avelis ?

@avelis
Copy link
Collaborator

avelis commented May 7, 2018

@albertyw Sounds good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants