Django Script Runner is a django-based web application, where you can run and demonstrate your Python script in an interactive way.
It can be used in the following scenarios:
- demo your course/work project
- build a simple web app with a useful python script of your own
- educate yourself or others
- Repository: https://github.com/yuanxu-li/django-script-runner
- Issues: https://github.com/yuanxu-li/django-script-runner/issues
Assume you want to demonstrate a multiply function of three floats
> git clone git@github.com:yuanxu-li/django-script-runner.git
> vi django-script-runner/scripts/scripts.py
Or use your favorite IDE to update the run
function in django-script-runner/scripts/scripts.py
.
The original file is
def run(a, b):
return int(a) + int(b)
Let's update it to
def run(mul_1, mul_2, mul_3):
return float(mul_1) * float(mul_2) * float(mul_3)
Rules of updating the function:
- Variable names and number of variables are changeable, such as
- Variables are always strings, and thus you should always cast the variables to the desired format
> python manage.py runserver
The prompt will tell where to find the web app. Usually it is http://127.0.0.1:8000/ Then you can type in three variables in the form, and click "Submit" to get your result back, as seen
If something is not working correctly, or if you have any suggestion on improvements, report it here
Copyright (c) 2020 Justin Li. Released under the MIT License
Third-party copyright in this distribution is noted where applicable.