Re: deployment with twistd of simple web application
Axel Rau <[email protected]> Fri, 8 Nov 2013 18:19:07 +0100
| Newsgroups | gmane.comp.python.twisted.web |
|---|---|
| Message-ID | <[email protected]> |
Am 08.11.2013 um 15:53 schrieb [email protected]: > On 12:33 pm, [email protected] wrote: >> >> Am 05.11.2013 um 13:25 schrieb Laufens Van Houtven <[email protected]>: >>> 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: ..and the backtrace: Axel --- PGP-Key:29E99DD6 ☀ +49 151 2300 9283 ☀ computing @ chaos claudius _______________________________________________ Twisted-web mailing list [email protected] http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
meteo_plugin.py
(text/x-python-script, 907 B)
from zope.interface import implements from twisted.application.service import IServiceMaker from twisted.application import internet from twisted.plugin import IPlugin from twisted.python import usage from meteo import meteoFactory class Options(usage.Options): optParameters = [ ['port', 'p', 80, 'The port number to listen on.'], ['ipv4_address', '4', None, 'The IPv4 address to listen on.'], ['ipv6_address', '6', None, 'The IPv6 address to listen on.']] class MeteoServiceMaker(object): implements(IServiceMaker, IPlugin) tapname = 'meteo' description = 'A web application for the meteo package' options = Options def makeService(self, options): """ Constructs a TCP server from a factory defined in meteo.py """ return internet.TCPServer( int(options['port'], interface=options['ipv4_address'], meteoFactory()) serviceMaker = MeteoServiceMaker()
backtrace.txt
(text/plain, 1.5 KB)
[meteo] [www4:py-venv/meteo/meteo] root# twistd --help
Unhandled Error
Traceback (most recent call last):
File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/python/usage.py", line 450, in __str__
return self.getSynopsis() + '\n' + self.getUsage(width=None)
File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/python/usage.py", line 486, in getUsage
for (cmd, short, parser, desc) in self.subCommands:
File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/application/app.py", line 631, in subCommands
for plug in sorted(plugins, key=attrgetter('tapname')):
File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/plugin.py", line 209, in getPlugins
allDropins = getCache(package)
--- <exception caught here> ---
File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/plugin.py", line 167, in getCache
provider = pluginModule.load()
File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/python/modules.py", line 383, in load
return self.pathEntry.pythonPath.moduleLoader(self.name)
File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/python/_reflectpy3.py", line 266, in namedAny
topLevelPackage = _importAndCheckStack(trialname)
File "/usr/local/py-venv/meteo/lib/python2.7/site-packages/twisted/python/_reflectpy3.py", line 205, in _importAndCheckStack
return __import__(importName)
exceptions.SyntaxError: invalid syntax (meteo_plugin.py, line 29)