Member Avatar

How would I use [web.py](http://www.webpy.org) to execute ASP/PHP server files? Or can web.py not do that and can someone provide me a python script that can execute ASP/PHP server files? Should I try posting this in the PHP forum, Web Design, html, and css fourm, or the Web development forum if I don't get an awnser here?

Member Avatar
0
9
Member Avatar

Web.py outputs 0.0.0.0:8080. On windows, localhost and 0.0.0.0 work. But on mavericks, localhost doesn't work! 0.0.0.0 works, though. Can someone explain what 0.0.0.0 is? Why does web.py say you can enter a ip and port in command line and it will run there? (You can't run on someone else's ip,can you?)

0
5
Member Avatar

import web,re,traceback urls=( "/","displaythreads" "/viewthread","displaythreads", "/viewthread/(.*)","displaythread", "/viewthread/(.*)/Vote/(Up|Down)","vote", "/newthread/(.*)","newthread", "/newthread","newthread" ) entries={}###{entryname:{property:value}} entrylength=0 class displaythreads: pass class newthread: template=web.template.frender("newthread.html") default=template("DEFAULT",0) def initialize(): pass def GET(): return default def POST(): data = web.input() try: username,threadname = data.username,data.threadname except: return template(mode) if threadname in entries: return template("Exists") entries[threadname]={"creator":username,"points":0,"totvotes":0} class displaythread: template=web.template.frender('Thread Viewer Template.html') def initialize(): pass def GET(self): return self.template( entrylength, entries.keys(), [value['name'] for value in entries.values()] ) class vote: template=web.template.frender('vote.html') def initialize(): pass def GET(self,thread,vote): try: current=web.cookies().get("Voted:"+thread) except: current="BEING DELETED" #act like it is being deleted if its not there. ######Set cookies and change votes######### ##Removing/Adding an extra vote if it was …

Member Avatar
0
13
Member Avatar

I am new to python web frameworks. I am using web.py because I like how raw it is. I am wondering though, how one can produce pages and scripts efficiently when being restricted to sending output through the return keyword? It seems like for any python module you can only send one thing to the browser, even if it is a large string. What am I missing about the python way of server-side scripting? If it helps, I am coming from a PHP perspective. I am used to being able to say print "foo" and foo will appear. Now I …

Member Avatar
0
4

The End.