On 23 October 2012 20:28, Chip Munk <[email protected]> wrote: > Hello, > > after a successful hello world I am now trying to do a bit more complex > stuff.. > > (but all i find are the hello world issues...) > so here are my questions: > > 1) If I have several .py scripts that are doing different calculations, how > do i run them from the wsgi script? > When I ad "import whatever" in the wsgi script, I get an error " No module > named whatever".
That is by design. The directory the WSGI script file is in, is not automatically in the Python module search path. There are various reasons why but if I explain them it will just confuse you as it ins't straight forward and needs some knowledge of how Python import system works. > and the module is in the same > folder as the wsgi script. Or, should I turn all my .py scripts in a wsgi > scripts?? I would very strongly recommend at this point that you stop going down the path of having separate WSGI script files in the one directory. When you do that they by default all run in separate sub interpreters of the same process. This will be inefficient. I would strongly recommend right now that you go learn how to use Flask (flask.pocoo.org), a Python micro framework which will teach you a better way of creating a Python web application than working at raw WSGI level. Part of what you will learn is how to structure the code for your application so that it is out of harms way and not easily downloadable by the users of your site, but such that modules will be found when you import them. > 2) how do I give arguments in the wsgi script? for example if I want to sum > two numbers in my wsgi script, > how do I give these two numbers by url or any other way? Go learn Flask. Read up how it handles HTML form data if these arguments are meant to come from a web page. > 3) I want to use the wsgi script to get the requests and run appropriate .py > scripts and return the results, is that > the best way to go? should I use some other technology? Usually you would do it all in process rather than execute separate scripts. Go learn Flask first though before you make such a decision. Also note that to learn Flask you can start by using its inbuilt development server. You do not need to run it up under mod_wsgi to learn it and trying to do so will only complicate your life. Worry about mod_wsgi when you actually need to deploy your site so that other people can use it. Graham > Please help, I cant seem to find clear answers out there... Or point me to > some > other group if you find it more appropriate. > > Thank you a lot! > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/modwsgi/-/ov2zKDgJtHkJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
