On Tue, Feb 9, 2016 at 11:47 AM, Xristos Xristoou <saxr...@gmail.com> wrote:

> hello,
>
>
> i create some python mathematical function on python idle,
> i want to create website where the user import value numbers on the
> function
> and take the results from that.
>

Usually this is done through a form. You can either have the user provide
the necessary values directly in input fields, or have the user upload a
file containing the information that your view will parse.


> question one,how to connect my mathematical function on the django?
>

Normally you would have the function on your path and import it for use
within your view. Nothing fancy required.


> question two,how to connect input and output from the scipts in the
> website ?
>

Generally your 'script' containing your math functions would not run
separately, rather they would be imported directly and run as part of the
same process that is running Django. You would add the necessary 'from foo
import bar' statements to grab the functions you need, and then simply
execute the functions from the data that you gathered in the form (or
parsed from the uploaded file from the user).

If the mathematical operations will take longer than a few seconds to
execute, you should also consider a batch processor to handle performing
the calculations in the background and having the user return to a status
page where they can check on their jobs. Long-running processes in the web
server can easily choke resources for a variety of reasons, whereas a batch
processor (such as Celery) is purpose-built to handle such operations.


> the second question i ask because input and output from the function is a
> dynamic define from the user
>

Gathering dynamic data is the entire purpose of forms. If all data from the
user was static, we'd never need to gather information from them. Complete
the tutorial project if you haven't done so, and that should become clear.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVK%2BjHraX44WtCg-XbH%3DvxUhEQCu2UxHLXkcHzZ%2BuMYqg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to