[Python] How to run Python file from Django

Discussão em 'Python' iniciado por Stack, Fevereiro 3, 2025.

  1. Stack

    Stack Membro Participativo

    How I can run a Python file, or Django file from Django view. I'm trying to make like iPython notebook, but use just text editor.

    I have create view, in this view I'm simply add Python(Django) text.

    Then when smb requests some view, which processes this Python(Django) file, I should send response with result.

    For example, print result of query set.

    In create view, I've added text:

    from main.models import User

    for i in User.objects.all()
    print(i)


    And in view I get request and send response with result of execution of code above.

    Continue reading...

Compartilhe esta Página