ok, if i remove app.setup(), the app launches, but all i get is 404 not
found.

#bt/code.py
app = web.application(urls, globals())



#main.py
from bt.code import app as bt_app
app = web.subdomain_application(
        "\*.XXX.com", bt_app,
)
if __name__ == "__main__":
    app.run()




On Fri, Oct 24, 2008 at 2:17 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote:

> ok, in the subdomain application i did not have app.setup(urls, globals),
> instead i hade app.run() from my original code.
>
> i changed it like this
>
> app = web.application(urls, globals())
> app.notfound = notfoundsearch
> app.setup(urls, globals())
> #if __name__ == '__main__':
>     #app.run(beak_session_mw)
>
>
> now i get this error
>
> Traceback (most recent call last):
>   File "./code.py", line 6, in <module>
>     from bt.code import app as bt_app
>   File "/home/mark/work/bt/code.py", line 66, in <module>
>     app.setup(urls, globals())
> AttributeError: application instance has no attribute 'setup'
>
>
>
>
> also how do i add middleware in this setup?
> thanks
>
>
> On Fri, Oct 24, 2008 at 2:00 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>wrote:
>
>> i get this error when doing subdomain applications
>>
>> Traceback (most recent call last):
>>   File "/home/mark/work/common/web/application.py", line 211, in wsgi
>>     result = self.handle_with_processors()
>>   File "/home/mark/work/common/web/application.py", line 183, in
>> handle_with_processors
>>     return process(self.processors)
>>   File "/home/mark/work/common/web/application.py", line 180, in process
>>     return self.handle()
>>   File "/home/mark/work/common/web/application.py", line 482, in handle
>>     fn, args = self._match(self.mapping, host)
>>   File "/home/mark/work/common/web/application.py", line 488, in _match
>>     what, result = utils.re_subm('^' + pat + '$', what, value)
>>   File "/home/mark/work/common/web/utils.py", line 359, in re_subm
>>     return compiled_pat.sub(repl, string), proxy.match
>>   File "/usr/lib/python2.5/re.py", line 261, in _subx
>>     template = _compile_repl(template, pattern)
>>   File "/usr/lib/python2.5/re.py", line 248, in _compile_repl
>>     raise error, v # invalid expression
>> error: bogus escape (end of line)
>>
>>
>>
>> this is my main file
>> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>> import web
>> from bt.code import app as bt_app
>>
>>
>>
>> app = web.subdomain_application(
>>         ".*\.XXX\.com", bt_app,
>> )
>>
>> if __name__ == "__main__":
>>     app.run()
>>
>>
>>
>>
>>
>>
>> can you tell what is wrong?
>> thanks
>>
>>
>> On Sat, Aug 11, 2007 at 9:01 AM, Anand <[EMAIL PROTECTED]> wrote:
>>
>>>
>>> # Multiple web apps
>>>
>>> The approach I am proposing here is slightly different from the one
>>> proposed by Adam Atlas in https://bugs.launchpad.net/webpy/+bug/119365.
>>>
>>>     import web
>>>
>>>     app = web.app()
>>>     urls = ("/.*", "hello")
>>>
>>>     class hello:
>>>         def GET(self):
>>>             print "hello, world!"
>>>
>>>     if __name__ == "__main__":
>>>         app.run(urls, globals())
>>>
>>> Each app maintains its own state including loadhooks, unloadhooks etc.
>>>
>>> It is possible to implement this without breaking the backward
>>> compatibility.
>>> This approach can be extended to support multiple subdirs and
>>> multiple subdomains by adding app.setup method.
>>>
>>>     # blog.py
>>>     import web
>>>
>>>     app = web.app()
>>>     urls = ("/.*", "blog")
>>>     app.setup(urls, globals())
>>>
>>>     class blog:
>>>        "blah blah blah"
>>>         pass
>>>
>>>     # wiki.py
>>>     import web
>>>
>>>     app = web.app()
>>>     urls = ("/.*", "wiki")
>>>     app.setup(urls, globals())
>>>
>>>     class wiki:
>>>        "blah blah blah"
>>>         pass
>>>
>>>     # subdir.py
>>>     import web
>>>     import wiki
>>>     import blog
>>>
>>>     app = web.subdir_app("/wiki", wiki.app, "/blog", blog.app)
>>>
>>>     if __name__ == "__main__":
>>>         app.run()
>>>
>>>     # subdomain.py
>>>     import web
>>>     import wiki
>>>     import blog
>>>     import web20
>>>
>>>     app = web.subdomain_app(
>>>         "wiki\.example\.com", wiki.app,
>>>         "blog\.example\.com", blog.app,
>>>         ".*\.example\.com", web20.app)
>>>
>>>     if __name__ == "__main__":
>>>         app.run()
>>>
>>> Using these multiple applications can be combined into one single web
>>> application very easily.
>>>
>>> # Multiple databases
>>>
>>>     import web
>>>     app = web.app()
>>>     db = web.database(app, dbn='mysql', db='wiki', user='root',
>>> pw='', pooled=True)
>>>
>>>     class wiki:
>>>         def GET(self, path):
>>>             d = db.query('SELECT * FROM wiki WHERE path=$path",
>>> vars=locals())
>>>             ....
>>>
>>> Since all the state is stored in the db object, it is possible to
>>> create multiple DB connections. app is passed to the database because
>>> it needs to register a look hook with the app.
>>>
>>> Again here also it is possible to maintain backward compatibility.
>>>
>>>
>>>
>>> >>>
>>>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to