On May 22, 1:48 pm, David Montgomery <[email protected]>
wrote:
> Thanks....well....
> when I ad
>
> def notfound():
> return web.notfound("Sorry, the page you were looking for was not
> found.")
>
> to my code...
>
> and I use
> application = web.application(urls, globals()).wsgifunc()
> application.notfound = notfound
>
> I get "not found" rather then my custom message....
>
> Works in my old code
Unless you haven't done what you need to for your setup to have the
source code reloaded, and so not actually using your now updated code,
then can only suggest it is a web.py setup issue. I can only help you
with the mod_wsgi bit which as far as the 'application' entry point is
now correct.
So, others more familiar with web.py will have to step in now and
help.
Graham
> Thanks
>
> On Thu, May 21, 2009 at 4:52 PM, Graham Dumpleton <
>
>
>
> [email protected]> wrote:
>
> > On May 22, 12:25 pm, David Montgomery <[email protected]>
> > wrote:
> > > Thanks,
> > > I got is working using this code...
>
> > > l am used to the if __name__ == "__main__":
>
> > > So...do I still use if __name__ == "__main__":?
>
> > No. I already said that.
>
> > The __name__ value will only be set to __main__ if the script was
> > being executed as script argument directly to command line Python.
> > This definitely will not be the case in mod_wsgi.
>
> > > What
> > > about application.notfound = notfound? Where do I place it?
>
> > Since it is making changes to 'application', obviously after you have
> > initialised the 'application' variable, else the code will fail
> > because there will be no variable of that name.
>
> > > Under the
> > > __main__?
>
> > No. Forget about __name__ and __main__ altogether.
>
> > Graham
>
> > > e.g.
>
> > > if __name__ == "__main__":
> > > application.notfound = notfound
>
> > > #!/usr/local/bin/python2.5
> > > import web
>
> > > urls=('/.*','index')
>
> > > class index:
> > > def GET(self):
> > > web.header("Content-Type","text/html; charset=utf-8")
> > > return "WSGI fsfsdfsdf KKKK Tdsfsfsfdest"
>
> > > application = web.application(urls, globals()).wsgifunc()
>
> > > On Thu, May 21, 2009 at 4:24 AM, andrei <[email protected]> wrote:
>
> > > > I've got two apps on webfaction using mod_wsgi, both are working.
>
> > > > import os, sys
> > > > rootdir = os.path.abspath(os.path.dirname(__file__))
> > > > sys.path.append(rootdir)
>
> > > > #...init your app here...
>
> > > > application = app.wsgifunc()
>
> > > > On May 21, 3:41 pm, David Montgomery <[email protected]>
> > > > wrote:
> > > > > I am using mod_wsgi on webfaction..
>
> > > > > On Thu, May 21, 2009 at 1:23 AM, Graham Dumpleton <
>
> > > > > [email protected]> wrote:
>
> > > > > > On May 21, 9:07 pm, Monty808 <[email protected]> wrote:
> > > > > > > Below is my barebones wsgi app...
>
> > > > > > > I dont have wsgi installed on my dev server...but I cant get it
> > to
> > > > > > > work on webfaction...
>
> > > > > > > If the code is right or wrong....please let me know....
>
> > > > > > > #!/usr/local/bin/python2.5
> > > > > > > import web
>
> > > > > > > web.internalerror = web.debugerror
> > > > > > > urls=('/','index')
>
> > > > > > > class index:
> > > > > > > def GET(self):
> > > > > > > web.header("Content-Type","text/html; charset=utf-8")
> > > > > > > return "WSGI Test"
>
> > > > > > > if __name__ == "__main__":
> > > > > > > web.webapi.internalerror = web.debugerror
> > > > > > > app = web.application(urls, globals()).wsgifunc()
>
> > > > > > How exactly are you trying to host it? Ie., what web server and if
> > > > > > Apache what module are you use, fastcgi, mod_python or mod_wsgi?
>
> > > > > > Graham
>
> > > > > --
> > > > > David Montgomery
> > > > > Chief Technical Officer
> > > > > Ad Alohahttp://www.AdAloha.com
> > > > > Honolulu, Hawaii 96815
> > > > > 808-351-5046
> > > > > Calandarhttp://users.adaloha.com/davidmontgomery_calandar
>
> --
> David Montgomery
> Chief Technical Officer
> Ad Alohahttp://www.AdAloha.com
> Honolulu, Hawaii 96815
> 808-351-5046
> Calandarhttp://users.adaloha.com/davidmontgomery_calandar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---