Forums

spyre framework not working

I have a small web app developed with spyre (https://github.com/adamhajari/spyre) that works locally for me but when trying to run it in pythonanywhere I can't get it working. I have installed the spyre module and copied the code but nothing.

Has anyone managed to run a spyre web app? Many thanks!

Your error logs should have some information about what's going on.

I don't know it you are still battling with spyre, but I also had problems, this is how I fixed:

According to python anywhere you shoud "Create a "Manually configured" web app * "

Then the code that worked for me in getting the spyre app was having the wsgi file look like this:

import sys
sys.stdout = sys.stderr

sys.path.append('directory_of_your_app') # change this accordingly
import atexit
import cherrypy

cherrypy.config.update({'environment': 'embedded'})

if cherrypy.__version__.startswith('3.0') and cherrypy.engine.state == 0:
    cherrypy.engine.start(blocking=False)
    atexit.register(cherrypy.engine.stop)

from script_file import name_of_your_app_class #the script file is the name of the file where you have your app
#the name of your app is the name of the class in that fileapp=SimpleSineApp()

 app=name_of_your_app_class()


application = cherrypy.Application(app.getRoot(), script_name='', config=None) #notice the getRoot() method

@lint78's advice looks excellent. This guide to debugging sys.path and import errors in your pythonanywhere wsgi file might also be of some use...

I don't know if somebody can help me with spyre, I managed to get a simple application running with the code I wrote before in the thread, however in spyre there is also the option of creating a site containing multiple apps, it does so by building a cherrypy root tree of all the apps, and that I can't seem to make it work in pythonanywhere. Does anybody have any idea how to rewrite the wsgi file so that it allows for multiple apps?

UPDATE: Fixed it if anybody needs instructions let me know.