I have a web2py form page which works locally, and on ubuntu running on ec2 
at Amazon.
I'm trying to set it up at pythonanywhere and I'm getting an error: 405 Not 
Allowed

I don't receive a web2py ticket or any other errors in the error log.  I 
don't see any errors using firebug.
I believe I've narrowed it down to the response.js for the SQLFORM.grid of 
search results.

Simplified / Shortened code:

-------------------------------------------------------------------------------------------------------------
index.html:
{{=LOAD('default','ask.load',ajax=True)}}
<div id="results">
</div>


ask.load:
{{=form.custom.begin}}
---a customized form ---
{{=form.custom.end}}


default.py
def index():
    return locals()
 
ask():
 #setup the query and other options
 data=SQLFORM.grid(query=query,fields=fields,formstyle='divs',csv=False,
searchable=False,paginate=15)
 response.js = "jQuery('{}').html('{}');".format("#results",data)



---------------------------------------------------------------------------------------------------------------------

Here's what's strange - I can return simple results via the web2py 
response.js method like this, 
data = "Hello World" 
response.js = "jQuery('{}').html('{}');".format("#results",data)
I can return a simple html response like:
data = "<div><b>Hello World</b></div>" 
response.js = "jQuery('{}').html('{}');".format("#results",data)
that all works. But the table of results from SQLFORM.grid doesn't work. 

So I figured something was wrong with the table, even though it's being 
created by a standard web2py component SQLFORM.grid

However if I pass the table back not via response.js the table renders fine.

I rewrote the application so instead of using {{=LOAD...}} I chagned ask() 
to index() and put the whole custom form in index.html
Then instead of using response.js I simply passed back {{=data}} to the 
page.  That works.  So it seems the SQLFORM.grid data 
is OK to PythonAnywhere since it renders fine if return it instead of using 
response.js.

I would like to use the ajax methodology instead since as I add more 
features to the page I don't want to be reloading everything.

Is there a problem with ask() which is called via LOAD from index, updating 
a <div> on index?  
If so why would it work locally?  As well as on an ubuntu instance on EC2?

Any thoughts?  Suggestions?  Could it be a setup issue at PythonAnywhere, 
(which I think is nginx and uwsgi)?
I've asked at PA, but I think it's a hard question for them to answer.

Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to