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

Usage with django #278

Open
sobolevn opened this issue Dec 2, 2024 · 1 comment
Open

Usage with django #278

sobolevn opened this issue Dec 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@sobolevn
Copy link

sobolevn commented Dec 2, 2024

Hi 👋

I want to integrate slotscheck to my django project. But, looks like that this is not possible right now. Because slotscheck imports code and does not run django.setup() before importing models (and some other stuff).

I propose adding pre_exec config value, so one can provide something like:

[tool.slotscheck]
pre-exec = '''
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'yourapp.settings')
import django
django.setup()
'''

And pre-exec will be called before the actual analysis begin.
What do you think?

@ariebovenberg
Copy link
Owner

@sobolevn thanks for posting. Looks like a common use case 👍 , and pre-exec looks like a sensible way to address it. I'll have try around with it to see if it works out.

@ariebovenberg ariebovenberg added the enhancement New feature or request label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants