[Twisted-web] deployment with twistd of simple web application

Axel Rau Axel.Rau at chaos1.de
Fri Nov 8 11:43:44 MST 2013


Am 08.11.2013 um 18:23 schrieb Jonathan Ballet <jon at multani.info>:

> On 11/08/2013 06:19 PM, Axel Rau wrote:
>> 
>> Am 08.11.2013 um 15:53 schrieb exarkun at twistedmatrix.com:
>> 
>>> On 12:33 pm, axel.rau at chaos1.de wrote:
>>>> 
>>>> Am 05.11.2013 um 13:25 schrieb Laufens Van Houtven <_ at lvh.io>:
>>>>> You probably want to read this:
>>>>> 
>>>>> https://twistedmatrix.com/documents/current/core/howto/application.html
>>>>> 
>>>>> There's a number of ways you can use twistd web, for example with a tac file, but personally I always opt for using a Twisted plugin, so you instead do twistd mything :)
>>>> 
>>>> [snip]
>>>> exceptions.SyntaxError: invalid syntax (meteo_plugin.py, line 29)
>>> 
>>> Unfortunately your code was mangled beyond recognition by your email client.
>>> 
>>> Try attaching the code instead so that we can see what you actually have.
>>> 
>> Sorry.
>> Here it comes:
> 
> 		return internet.TCPServer(	int(options['port'],
> 								  ^^^
> 
> You are missing a closing parentheses here.

You are right (-;, but now I come to my real question: 
---
[meteo] [www4:py-venv/meteo/meteo] root# twistd --pidfile=/var/run/twisted/meteo.pid -u www -g www -r kqueue  meteo
Traceback (most recent call last):
  File "/usr/local/py-venv/meteo/bin/twistd", line 14, in <module>
    run()
  File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/scripts/twistd.py", line 27, in run
    app.run(runApp, ServerOptions)
  File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/application/app.py", line 652, in run
    runApp(config)
  File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/scripts/twistd.py", line 23, in runApp
    _SomeApplicationRunner(config).run()
  File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/application/app.py", line 386, in run
    self.application = self.createOrGetApplication()
  File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/application/app.py", line 446, in createOrGetApplication
    ser = plg.makeService(self.config.subOptions)
  File "/usr/local/py-venv/meteo/meteo/twisted/plugins/meteo_plugin.py", line 26, in makeService
    meteoFactory(),
AttributeError: Site instance has no __call__ method
---
makeService expects a protocol factory, but I have only
	meteoFactory = Site(resource)
How do I interface the former to the http protocol?

Axel
---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius




More information about the Twisted-web mailing list