Hi!
After some code rework, I got it working.
The trick is that factories aren't supported in UPD, and they work directly
in the service creation.
Flask seems to work in the same way, not needing to be wrapped into any
factory or so. However in order not to have a .tac file loaded with the
routes and this stuff I've used flask-classy. Half an hour later everything
seems to work.
Here is my current tac file:
-----------------------------------------
from twisted.internet import reactor
from twisted.application import service, internet
from twisted.web.server import Site
from twisted.web.wsgi import WSGIResource
from flask import Flask
from server import Server
from bootloader import BootLoaderServer
from restful_api import RestFulApi
flask_app = Flask("restfulapi", static_folder="www", static_url_path="")
flask_app.debug = True
flask_resource = WSGIResource(reactor, reactor.getThreadPool(), flask_app)
flask_site = Site(flask_resource)
RestFulApi.register(flask_app)
server = Server()
server.load_cfg("default.cfg")
bootloader_server = BootLoaderServer()
application = service.Application("unidosys")
multi_service = service.MultiService()
flask_service = internet.TCPServer(8080, flask_site)
main_service = internet.UDPServer(Server.port, server)
bootloader_service = internet.UDPServer(BootLoaderServer.multicast_port,
bootloader_server)
flask_service.setServiceParent(multi_service)
main_service.setServiceParent(multi_service)
bootloader_service.setServiceParent(multi_service)
unidosys_service.setServiceParent(application)
-----------------------------------------
So far so good ;).
Thanks for your kind help and for this fantastic framework.
All the best, Beth.
On 2 July 2013 21:29, Glyph <[email protected]> wrote:
>
> On Jul 2, 2013, at 12:02 PM, Beth <[email protected]> wrote:
>
> Can someone give me a hand in how to daemonize one application?
>
>
> I think that the way to go is twistd (...)
>
>
> That's correct.
>
> After reading the rest of your message, I don't see any *problems* that
> you've had with using it. All the code looks basically right, and you
> don't mention any tracebacks.
>
> If "just use twistd" doesn't help you, can you explain what exactly
> doesn't work when you try to use it?
>
> -glyph
>
> _______________________________________________
> Twisted-Python mailing list
> [email protected]
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python