1

I'm following the heroku quick start guide here: https://devcenter.heroku.com/articles/getting-started-with-python

and I'm stuck on the foreman start part. This is what my directory looks. I'm just running a basic web app. No frameworks or anything.

soapbar/
    Procfile.txt
    soapbar/
        soapbar.py
        __init__.py
    venv/
        Include/
        Lib/
        Scripts/ 

This is whats inside my Procfile:

web: gunicorn soapbar.soapbar:app

This is the stack trace:

09:28:54 web.1  | started with pid 34567
09:28:54 web.1  | 2014-03-20 09:28:54 [34567] [INFO] Starting gunicorn 18.0
09:28:54 web.1  | 2014-03-20 09:28:54 [34567] [INFO] Listening at: http://0.0.0.0:5000 (34567)
09:28:54 web.1  | 2014-03-20 09:28:54 [34567] [INFO] Using worker: sync
09:28:54 web.1  | 2014-03-20 09:28:54 [34570] [INFO] Booting worker with pid: 34570
09:28:54 web.1  | Failed to find application: 'soapbar.soapbar'
09:28:54 web.1  | 2014-03-20 09:28:54 [34570] [INFO] Worker exiting (pid: 34570)
09:28:54 web.1  | 2014-03-20 09:28:54 [34567] [INFO] Shutting down: Master
09:28:54 web.1  | 2014-03-20 09:28:54 [34567] [INFO] Reason: App failed to load.
09:28:54 web.1  | exited with code 4
09:28:54 system | sending SIGTERM to all processes
SIGTERM received

Please help.

This is soapbar.py:

import logging
import os

from spyne.application import Application
from spyne.decorator import srpc
from spyne.interface.wsdl import Wsdl11
from spyne.protocol.soap import Soap11
from spyne.service import ServiceBase
from spyne.model.complex import Iterable
from spyne.model.primitive import Integer
from spyne.model.primitive import String
from spyne.server.wsgi import WsgiApplication

class MessageService(ServiceBase):
    @srpc(String, Integer, _returns=Iterable(String))
    def send_message(msg):
        yield 'Your message: %s' % msg

if __name__=='__main__':
    try:
        from wsgiref.simple_server import make_server
    except ImportError:
        print "Error: server requires Python >= 2.5"

    logging.basicConfig(level=logging.INFO)
    logging.getLogger('spyne.protocol.xml').setLevel(logging.DEBUG)

    application = Application([MessageService], 'org.temporary.soap',
            interface=Wsdl11(), in_protocol=Soap11(), out_protocol=Soap11())

    port = int(os.environ.get('PORT', 5000))

    server = make_server('0.0.0.0', port, WsgiApplication(application))

    print "listening to http://0.0.0.0:%s" % port
    print "wsdl is at: http://0.0.0.0:%s/?wsdl" % port

    server.serve_forever()
user2769651
  • 171
  • 1
  • 3
  • 15
  • Is your PYTHONPATH setup correctly, to include the location of your module? – bosnjak Mar 20 '14 at 13:42
  • PYTHONPATH? I'm using an venv environment so it won't matter right? – user2769651 Mar 20 '14 at 13:45
  • Not sure, but won't hurt to check this: http://stackoverflow.com/questions/4757178/how-do-you-set-your-pythonpath-in-an-already-created-virtualenv – bosnjak Mar 20 '14 at 13:47
  • modded by PYTHONPATH but it didn't work :/ . It seems like it somehow knows where it is because when I remove the init file I get the can't find module. So gunicorn knows its there but it can't find the application? – user2769651 Mar 20 '14 at 13:57
  • Do you get a different error if you change Procfile to be web:gunicorn soapbar.soapbar2:app? How big is soapbar.py? can you paste it? the problem could be inside of there. – bwbrowning Mar 20 '14 at 15:53
  • Doing that would give me the same error: "Can't find application: soapbar2" – user2769651 Mar 20 '14 at 16:11

1 Answers1

0

It might not be your whole problem, but look at the flask example that heroku uses in that tutorial, they actually have an 'app' variable ( wsgi server ) defined in the python file ( not under main ). Thats why their foreman file has :app. Yours has :app too, but you don't have an app defined.

import os
from flask import Flask

app = Flask(__name__)

@app.route('/')
def hello():
    return 'Hello World!'
bwbrowning
  • 6,200
  • 7
  • 31
  • 36