not have from ladon.server.wsgi import LadonWSGIServer
Hi. I try use your framework but i try
from ladon.server.wsgi import LadonWSGIServer
I get error because LadonWSGIServer not exist in Ladon ver 0.5x ?
What solve this problem?
Thanks
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- ladon Edit question
- Assignee:
- jsgaarde Edit question
- Last query:
- 2011-07-25
- Last reply:
- 2012-01-24
This question was reopened
- 2011-07-22 by romankrv
jsgaarde (jakob-simon-gaarde) said : | #1 |
Hi
I see you have followed the example from the documentation which is an old example. Some things have changed since then which is why you get the error. I will change the documentation as soon as I can. Until then I can tell you that the changes are for the better.
To test your service all you need to do now is call ladonX.Yctl. For instans if you are using Python 2.7 and have a service implemented in the script myservice.py, then you would run the command:
ladon2.7ctl serve myservice.py -p 8080
(change the "2.7" to match the Python version you are using)
This command will start your service on port 8080 If you are running Windows you might want to take a look at this stackoverflow question:
http://
Lastly there is a video tutorial that covers this topic:
http://
Best regards
Jakob Simon-Gaarde
romankrv (romankrv) said : | #2 |
ok. thanks.
also i try use as you reccomended:
i type to shell: ladontest$ ladon2.6ctl serve testservice.py -p 8080
after it i get there
Options: {'verbose': False, 'port': '8080'}
Modules: testservice.py
localhost.
after there i go to firefox:
go to url: http://
end I get error:
Traceback (most recent call last):
File "/home/
exec("import %s" % ','.join(
File "<string>", line 1, in <module>
File "/home/
class TestService(
File "/home/
ladon_
File "/home/
src_fname = f.__code_
AttributeError: type object 'TestService' has no attribute '__code__'
code testservice.py:
from ladon.ladonizer import ladonize
@ladonize(unicode, rtype=unicode)
class TestService(
def helloworld(self, name):
return "Hello %(name)s" % locals()
I use ladon 0.5.1. install it via pip install ladon
Can you help me with that problem?
Thanks
jsgaarde (jakob-simon-gaarde) said : | #3 |
You have ladonized the whole class. You can only ladonize methods:
from ladon.ladonizer import ladonize
class TestService(
@ladonize(
def helloworld(self, name):
return "Hello %(name)s" % locals()
romankrv (romankrv) said : | #4 |
Ok i understand my wrong. it my spelling !!!
also are you recommended use ladon intend of soaplib? landon is more powerfull and who develop it and who use it libary too?
thanks
jsgaarde (jakob-simon-gaarde) said : | #5 |
I develop Ladon :-) and it is active soaplib is dead as far as I can see. Also Ladon is a lot more extentable. You can make new protocols and serve your service to many protocols at once.
JSON-WSP is very effective if you are developing a service that should be accessable from a website.
/ Jakob Simon-Gaarde
romankrv (romankrv) said : | #6 |
O great. Who help to you in develop too?
romankrv (romankrv) said : | #7 |
Also I question is:
In docs you write
server.py:
from ladon.server.wsgi import LadonWSGIServer, LadonWSGIApplic
application = LadonWSGIApplic
server = LadonWSGIServer
server.run()
but how use this in 0.5.1 because in source Landon not have class -- >> LadonWSGIServer
How to start wsgi server?
Can you simple exapmle?
Thanks !!!
romankrv (romankrv) said : | #8 |
Thanks jsgaarde, that solved my question.
romankrv (romankrv) said : | #9 |
Also I question is:
In docs you write
server.py:
from ladon.server.wsgi import LadonWSGIServer, LadonWSGIApplic
application = LadonWSGIApplic
server = LadonWSGIServer
server.run()
but how use this in 0.5.1 because in source Landon not have class -- >> LadonWSGIServer
How to start wsgi server?
Could you give me simple exapmle?
Thanks !!!
jsgaarde (jakob-simon-gaarde) said : | #10 |
> O great. Who help to you in develop too?
I am the only Ladon for Python developer for now. There is a Ladon for PHP developer too. Right now we are working on the new Ladon website:
http://
> but how use this in 0.5.1 because in source Landon not have class -- >> LadonWSGIServer
> How to start wsgi server?
> Could you give me simple exapmle?
Example:
from ladon.server.wsgi import LadonWSGIApplic
import wsgiref.
if __name_
port = 8888
application = LadonWSGIApplic
server = wsgiref.
But... You should only use this method and ladonX.Yctl to test your service. When you go in production you should use a real webserver. As shown in example 2 in the docs:
http://
romankrv (romankrv) said : | #11 |
Ok thanks for answer.
Could you explain why I get error :
Traceback (most recent call last):
File "/usr/local/
exec("import %s" % ','.join(
File "<string>", line 1, in <module>
ImportError: No module named SessionService
my code is (where I get error):
from ladon.ladonizer import ladonize
class SessionService(
@ladonize(
def login(self,
session_id = '111'
return session_id
from ladon.server.wsgi import LadonWSGIApplic
import wsgiref.
if __name_
port = 8889
application = LadonWSGIApplic
server = wsgiref.
Thanks
jsgaarde (jakob-simon-gaarde) said : | #12 |
Hi Romankrv.
I am guesseing that you servicemodule is not called SessionService.py (capital S). If the module filename is sessionservice.py then you must write ' sessionservice' when you create the LadonWSGIApplic
Best regards
Jakob Simon-Gaarde
jsgaarde (jakob-simon-gaarde) said : | #13 |
And the last one :-)
jsgaarde (jakob-simon-gaarde) said : | #14 |
Setting to solved, so other people can benefit from the info.