Two things:
1. You need an __init__.py file in the handlers directory
2. Your script line should read 'handlers.test.application'

On Saturday, 10 November 2012 10:52:35 UTC+11, Kyle Finley wrote:
>
> Shan, if you are using the python27 runtime it should be:
>
> # app.yaml
>
> runtime: python27
>
> - url: /test
>   script: handlers/test.application
>
>
> https://developers.google.com/appengine/docs/python/config/appconfig#Script_Handlers
>
> -- Kyle
>
> On Friday, November 9, 2012 9:18:35 AM UTC-6, Shan Sikdar wrote:
>>
>> Hi basic question,
>>
>> Basically I'm having trouble modularizing handlers in GAE.
>>
>> Specifically in my application I have a download button that calls a Test 
>> handler so far I have:
>>  <script>     
>>  $('#download').button().click(function(){
>>             $('<iframe id="dlBox" name="dlBox" hieght=0px width=0px 
>> src="/test">').appendTo('body');
>>              
>>         });
>> </script>
>>
>> And then at the bottom of the code I have :
>>
>> class Test(webapp2.RequestHandler):
>>     def get(self):
>>         logging.info("Entered Handler")
>>         self.response.headers['Content-Type'] = 'text/csv'
>>         self.response.headers['Content-Disposition'] = "attachment; 
>> filename=fname.csv"
>>         self.response.out.write(','.join(['a', 'cool', 'test']))         
>>
>> application = webapp2.WSGIApplication([('/', MainHandler),
>>                                         ('/query', QueryHandler),
>>                                       ('/test', Test) ],
>>                                         debug=True)       
>> And this works but I want to be able to make the Test class into its own 
>> .py file. 
>>
>> So I made a folder called handlers saved the class as test.py and then 
>> changed my app.yaml to include:
>> - url: /test
>>   script: handlers/test.py
>>
>> However when I try clicking the download button it gives the error : 
>> ImportError('Could not find module %s' % fullname)
>> ImportError: Could not find module handlers.test
>>
>> I have also tried changing the app.yaml to:
>> - url: /handlers
>>   static_dir: handlers
>>
>> and changing the source in the javascript code to src="/handlers/test.py" 
>> but in this case there's no error but also it doesn't enter the handler at 
>> all it simply just says "GET /handlers/test.py HTTP/1.1" 200 -
>>
>> What am I missing?
>>
>> Thanks!
>>
>>         
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/istXVwDc0kYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to