Hi, thanks for your response. That seems like a good solution and I think I'm
going to go that way, but I still ask ...
Is there a possibility to change the code in rewrite.py so that it does not
throw the error, but does not include that domain in the list and make a log
warining?
domains = dict()
if routers.BASE.domains:
for (d, a) in routers.BASE.domains.iteritems():
(domain, app) = (d.strip(':'), a.strip('/'))
if ':' in domain:
(domain, port) = domain.split(':')
else:
port = None
if '/' in app:
(app, ctlr) = app.split('/', 1)
else:
ctlr = None
if ctlr and '/' in ctlr:
(ctlr, fcn) = ctlr.split('/')
else:
fcn = None
if app not in all_apps and app not in routers:
raise SyntaxError("unknown app '%s' in domains" % app)
domains[(domain, port)] = (app, ctlr, fcn)
routers.BASE.domains = domains
El miércoles, 11 de julio de 2018, 10:55:58 (UTC-3), Anthony escribió:
> routes.py is just Python code, so you can write code that will dynamically
> generate the "domains" dictionary based on folders found in the
> /applications folder. However, whenever you make a change, you will still
> need to reload routes.py (or restart the web server), as routes.py is only
> executed once upon startup.
>
> Anthony
>
> On Wednesday, July 11, 2018 at 9:47:30 AM UTC-4, fiubarc wrote:
>>
>> Hello, i need help with this behavior
>>
>> Steps to reproduce:
>>
>> 1) routes.py
>>
>> domains = { "app1.com" : "app1", "app2.com" : "app2"}
>>
>> 2) uninstall app1
>>
>> 3) the app2 can not be accessed, not even the admin interface.
>>
>> Web2py Log:
>>
>> [Tue Jul 10 11:16:58 2018] [error] mod_wsgi (pid=2115): Target WSGI script
>> '/home/www-data/web2py/wsgihandler.py' cannot be loaded as Python module.
>> [Tue Jul 10 11:16:58 2018] [error] mod_wsgi (pid=2115): Exception occurred
>> processing WSGI script '/home/www-data/web2py/wsgihandler.py'.
>> [Tue Jul 10 11:16:58 2018] [error] Traceback (most recent call last):
>> [Tue Jul 10 11:16:58 2018] [error] File
>> "/home/www-data/web2py/wsgihandler.py", line 33, in <module>
>> [Tue Jul 10 11:16:58 2018] [error] import gluon.main
>> [Tue Jul 10 11:16:58 2018] [error] File
>> "/home/www-data/web2py/gluon/main.py", line 128, in <module>
>> [Tue Jul 10 11:16:58 2018] [error] load_routes()
>> [Tue Jul 10 11:16:58 2018] [error] File
>> "/home/www-data/web2py/gluon/rewrite.py", line 381, in load
>> [Tue Jul 10 11:16:58 2018] [error] load_routers(all_apps)
>> [Tue Jul 10 11:16:58 2018] [error] File
>> "/home/www-data/web2py/gluon/rewrite.py", line 530, in load_routers
>> [Tue Jul 10 11:16:58 2018] [error] raise SyntaxError("unknown app '%s'
>> in domains" % app)
>> [Tue Jul 10 11:16:58 2018] [error] SyntaxError: unknown app 'app1' in
>> domains
>>
>>
>>
>> 4) remove app1 from domains in routes.py
>>
>> 5) problem resolved
>>
>> The question is whether there is any way to catch the error so that the
>> other installed applications can continue running without editing routes.py
>>
>> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.