[web2py] Can I make my own controller?
Hello everyone! I've set up a Raspberry Pi with web2py and am playing with it. I have two questions. 1. I have made a website on the 0.0.0.0 server, and have my own module in modules that I am importing into a controller function. However, I am unable to make and use my own controller function. I have both my controller function in the default.py controller, and I made my own test_controller.py file that I have the same function in that file. This always works: http://MY_IP/test_app/*default*/test_controller_function But this: http://MY_IP/test_app/*test_controller*/test_controller_function returns the message: *invalid view (test_controller/test_controller_function.html)* * * 2. Why must you have a .html file that matches the name of the function you are calling? e.g. if you go to: http://MY_IP/test_app/default/test_controller_function I had to make a test_controller_function.html otherwise I would get this again: returns the message: *invalid view (test_controller/test_controller_function.html)* * * * * *Thanks!* -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Can I make my own controller?
You are awesome. Thank you! On Friday, September 13, 2013 3:26:54 PM UTC-7, Anthony wrote: 1. Any time I log on to the website remotely and try to edit the site I get: Admin is disabled because insecure channel This is bothersome, as I want to be able to leave the Pi at work on a test system and play with it from home. admin requires connection via SSL or localhost, otherwise it's a serious security risk. To get a localhost connection, you can ssh into the server. 2. I am unable to make and use my own controller function. I have both my controller function in the default.py controller, and I made my own test_controller.py file that I have the same function in that file. This always works: http://MY_IP/test_app/*default* /test_controller_function But this: http://MY_IP/test_app/*test_controller* /test_controller_function returns the message: *invalid view (test_controller/test_controller_function.html)* If your controller returns a dict, web2py assumes it must then execute a view, and by default it looks for the view in /views/[controller name]/[function name].[request extension]. You can direct it to a different view by setting response.view to a different file path within the /views folder. You can also take advantage of the generic.html view. By default, generic views are turned off, but in the scaffolding app, there is a line in the db.py model file that turns them on on localhost only. Note, if you don't want to use a view at all, then just have your controller return a string instead of a dict. 3. Why must you have a .html file that matches the name of the function you are calling? e.g. if you go to: http://MY_IP/test_app/default/test_controller_function I had to make a test_controller_function.html See above. Note, the name doesn't have to match -- that's just a default -- you can use a different name but you must then be explicit about it by setting response.view or calling response.render() directly. Check out the Workflow and Dispatching sections of the Corehttp://web2py.com/books/default/chapter/29/04/the-corechapter as well as http://web2py.com/books/default/chapter/29/10/services#Generic-views. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Raspberry Pi and web2py: No 19x.16x.xxx.xx option
Hello all, I have web2py installed on my Raspberry Pi. I have downloaded the source code from the website as well as trying to follow this instructable: http://www.instructables.com/id/Raspberry-Pi-GPIO-home-automation/ Neither of these install methods include the option to launch a public server with the IP form: 192.168.xxx.xx I am able to create a website with my PC using web2py and this IP form, and am guessing that if this form were available on my RPi it will work. Because when I try the forms BESIDES the above one on my PC I cannot log onto my PC's server from another computer. Only this 192.168.xxx.xx form works. I do have these options on the RPi: Public (0.0.0.0) Public(127.0.1.1) but again, I can't log into either of them from another computer. Any ideas what I'm bumping up against? I am hooked up to Ethernet at my work on both the PC and the RPi. Thanks! -Zach -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Raspberry Pi and web2py: No 19x.16x.xxx.xx option
I will check ifconfig and let you know what IP it gets assigned. I assumed that I needed to log on to the same IP address that is displayed in my browser on the Pi. Is this not the case? I have tried the 0.0.0.0 this way with no luck. -Zach On Thursday, September 12, 2013 2:33:11 PM UTC-7, Niphlod wrote: what ip address gets assigned to the raspberry ? (see the output of ifconfig). No matter what, you can always run web2py using 0.0.0.0, that means accept connections listening on all ip addresses On Thursday, September 12, 2013 11:28:39 PM UTC+2, Zachary Burrows wrote: Hello all, I have web2py installed on my Raspberry Pi. I have downloaded the source code from the website as well as trying to follow this instructable: http://www.instructables.com/id/Raspberry-Pi-GPIO-home-automation/ Neither of these install methods include the option to launch a public server with the IP form: 192.168.xxx.xx I am able to create a website with my PC using web2py and this IP form, and am guessing that if this form were available on my RPi it will work. Because when I try the forms BESIDES the above one on my PC I cannot log onto my PC's server from another computer. Only this 192.168.xxx.xx form works. I do have these options on the RPi: Public (0.0.0.0) Public(127.0.1.1) but again, I can't log into either of them from another computer. Any ideas what I'm bumping up against? I am hooked up to Ethernet at my work on both the PC and the RPi. Thanks! -Zach -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Python Module, USB device, web2py
Hello all! My boss wants me to use web2py to call a script that reads a value from a multimeter. He wants that value put onto a web2py page. I have written the script, but am not getting anywhere in trying to call it and display its result on my web2py page. I just keep breaking stuff (getting errors). I'm not a web developer, but I've been reading about MVC design and going through Python the Hard Way. I'm learning, but am far from the promised land. Can anyone give me a quick and dirty way to do this? Or am I in WAY over my head? Cuz that's how I feel right now. thanks! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Run Python Script and Display Result
Hello everyone! I am working on a project, and want to use web2py to display the result of a python module I have written (which reads some data from a multimeter and returns a value). I am looking for a quick and dirty way to get this done. I'd eventually like to learn about web development more, and implement web2py in some home automation, but right now my boss just wants a quick proof of concept. I've been reading a lot about model-view-controller, and going through Python the Hard Way so I'm on my way to the promised land of python web development, but I'm a far cry from having a handle on web2py. Please help me. :P Thanks! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.