On 6 April 2010 15:10, SamG <mad....@gmail.com> wrote:Forgive me for this rants...
I finally figured out that you needs to delete the index.html and
"clear the cache" from your browser.Hi Sam,Firstly, sorry for delayed reply but I've just got back from a short holiday. Thanks to Yoan (as always) for helping.Glad you got things sorted out in the end, sorry it wasn't more obvious what you needed to do.The public/index.html only really exists so that *something* useful is displayed by default. Assuming you read the index.html content ;-) how can we make it clearer that index.html should be deleted to expose your root resource?For instance, would it have helped if the generated root resource referenced the index.html file, e.g.:class Root(resource.Resource):@resource.GET()def html(self, request):# Not seeing this? Delete example/public/index.html to expose this resource.return http.ok([('Content-Type', 'text/html')],"<p>Hello from example!</p>")Or perhaps making index.html describe the project's structure more would be more useful?Any feedback would be appreciated.- Matt
And i got GET working but still have issues with the POST, still get a
405. I did a basic app to test this....
import logging
from restish import http, resource
import EC2
log = logging.getLogger(__name__)
class Root(resource.Resource):
@resource.POST()
def html(self, request):
return http.ok([('Content-Type', 'text/html')],
"<p>Hello from my002!</p>")
> And did a get onhttp://127.0.0.1:8080/using firefox AddOn
On Apr 6, 6:21 pm, SamG <mad.vi...@gmail.com> wrote:
> Well this very suprising.
>
> I create another project, my002.
>
> RESTClient.
>
> And i got the following as the response
>
> <html>
> <head>
> <title>my002</title>
> </head>
> <body>
> <h1>my002</h1>
> <p>This is the default page for the my002 project.</p>
> <p>The page is called index.html and is part of your application's
> package,
> my002, inside the public/ directory, i.e. my002/public/
> index.html.</p>
> <p>Any files you add to the public directory will be served in
> preference
> to your application's dynamic resources.</p>
> <p>When you're ready simply delete index.html and your root
> resource will
> be returned for this URL instead.</p>
> </body>
> </html>
>
> But the response should be the <p>Hello from my002!</p> right?
>
> I am using retish 0.10
>
> Sam
>
> On Apr 6, 5:40 pm, SamG <mad.vi...@gmail.com> wrote:
>
> > I added POST to the allowed_methods tuple. But when i do a POST
> > request i end up getting the following as the response.
>
> > <html>
> > <head>
> > <title>my001</title>
> > </head>
> > <body>
> > <h1>my001</h1>
> > <p>This is the default page for the my001 project.</p>
> > <p>The page is called index.html and is part of your application's
> > package,
> > my001, inside the public/ directory, i.e. my001/public/
> > index.html.</p>
> > <p>Any files you add to the public directory will be served in
> > preference
> > to your application's dynamic resources.</p>
> > <p>When you're ready simply delete index.html and your root
> > resource will
> > be returned for this URL instead.</p>
> > </body>
> > </html>
>
> > Instead of an expected xml.
>
> > Sam
>
> > On Apr 6, 5:18 pm, SamG <mad.vi...@gmail.com> wrote:
>
> > > Well has it got something to do with this?
>
> > >(restish)sam@csslabs-laptop-xubuntu:/sandbox/restish/lib/python2.6$
> > > grep -inHR allowed * | grep -i methods
> > > site-packages/Paste-1.7.3-py2.6.egg/paste/fileapp.py:57:
> > > allowed_methods = ('GET', 'HEAD')
>
> > > which allows on the 'GET' and 'HEAD' method?
>
> > > Sam
>
> > > On Apr 6, 4:36 pm, SamG <mad.vi...@gmail.com> wrote:
>
> > > > Sorry,
>
> > > > here is the codehttp://dpaste.de/iOJQ/
>
> > > > Sam
>
> > > > On Apr 6, 11:40 am, Yoan Blanc <yoan.bl...@gmail.com> wrote:
>
> > > > > Can you post your code somewhere?
>
> > > > > --
> > > > > Yoan
>
> > > > > 2010/4/6 Madireddy Samuel Vijaykumar <mad.vi...@gmail.com>:
>
> > > > > > Hi,
>
> > > > > > I am trying to implement a small sample webservice. The GET method there are
> > > > > > no issues. But when i try to implement a POST. I get a 405, saying that POST
> > > > > > method is not allowed for this resource. Could someone help in this regard.
>
> > > > > > Sam
>
> > > > > > --> > > You received this message because you are subscribed to the Google Groups> > "ish.io" group.> To post to this group,sendanema...@googlegroups.com.> > To unsubscribe from this group, send email to>ishio+un...@googlegroups.com.
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/ishio?hl=en-GB.
>
>
--
You received this message because you are subscribed to the Google Groups "ish.io" group.
To post to this group, send an email to is...@googlegroups.com.
To unsubscribe from this group, send email to ishio+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ishio?hl=en-GB.
--
You received this message because you are subscribed to the Google Groups "ish.io" group.
To post to this group, send an email to is...@googlegroups.com.
To unsubscribe from this group, send email to ishio+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ishio?hl=en-GB.
I got a lot of things working after, in fact i am figuring out various wsgi servers to work with restish. Which is one thing lacking your, documentation. I guess you should, tell what to do with spawn, gunicorn, tornado, gevent etc.
Restish is truly great, i am going to use it in production for my next project. I will let you know how it is going.
And yes, about the index.html showing up. You are right about putting in a comment in the root.py code. But it would help to tell in the index.html page more prominently about it, inside a <h1> tag :)
I committed a couple of changes earlier. The first adds a comment in
root.py; the second improves the index.html page. If you get the
chance to look could you let me know if you think it would have helped
at least a little.
The index.html is standalone so I've attached it to this email to save
you generating a new project.
- Matt