Skip to content

Django: use yapf to adjust settings? #81

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

Open
hartym opened this issue Mar 9, 2018 · 0 comments
Open

Django: use yapf to adjust settings? #81

hartym opened this issue Mar 9, 2018 · 0 comments

Comments

@hartym
Copy link
Member

hartym commented Mar 9, 2018

Following code kept for reference even if not working, but it would be amazing to be able to tune settings (like ensure that something is in INSTALLED_APPS). Maybe not achievable easily and safely, though.

    # Use yapf to adjust settings (for example, add some apps).
    @subscribe('medikit.feature.django.on_configure')
    def on_django_configure(self, event):
        original_source, newline, encoding = yapf_api.ReadFile('config/settings.py')
        print(original_source, newline, encoding)
        reformatted_code, encoding, has_change = yapf_api.FormatFile(
            'config/settings.py',
            in_place=True,
        )
        print(reformatted_code, encoding, has_change)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant