what goes in config.ru for a passenger_wsgi.py app?

171 views
Skip to first unread message

TJ Connelly

unread,
Feb 16, 2014, 2:58:12 PM2/16/14
to phusion-...@googlegroups.com
Hello,

It seems like I'm missing something big and simple: the step by step instructions in the users guide make it clear that "Phusion Passenger supports all WSGI-compliant Python web applications", which is fine, but then a few lines later makes it clear you need to have a config.ru file.

What's missing is what goes into that file. 

I have a passenger_wsgi.py file ready to go, with the contents of the 'hello world' as specified in the documentation. Apache & Passenger seem happy.

I've spent the last couple hours searching around trying to sort out this missing element.  I've messed around with a bunch of different possibilities in config.ru and I'm getting nowhere. I'm new to the world of Ruby/Rack/etc and am mostly trying to get to the point when I can use Passenger to handle python apps.

Can anyone shine a light?

Thanks,
|tj

The doc, btw: 

Hongli Lai

unread,
Feb 17, 2014, 5:40:01 PM2/17/14
to phusion-passenger
Config.ru is for Ruby only. It is the entry point for your Rack
application object. To learn what Rack is, please refer to
http://rubylearning.com/blog/a-quick-introduction-to-rack/

Of course, config.ru does not apply to Python apps. Python's Rack
equivalent is WSGI, defined in PEP 333. There is no standard entry
point file for WSGI, such as Rack has with config.ru, so we chose to
define the entry point as passenger_wsgi.py. This means that in
passenger_wsgi.py, you must define your WSGI application object, which
grants access to the rest of your web app. How this WSGI application
object looks like totally depends on your application.

Learn more about WSGI here:
http://www.python.org/dev/peps/pep-0333/
http://www.xml.com/pub/a/2006/09/27/introducing-wsgi-pythons-secret-web-weapon.html
> --
> You received this message because you are subscribed to the Google Groups
> "Phusion Passenger Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to phusion-passen...@googlegroups.com.
> To post to this group, send email to phusion-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/phusion-passenger.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/phusion-passenger/a621011d-f26e-4c36-a71c-e2263358aabb%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Phusion | Ruby & Rails deployment, scaling and tuning solutions

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

TJ Connelly

unread,
Feb 22, 2014, 12:40:33 PM2/22/14
to phusion-...@googlegroups.com
OK. I don't mean to be dense, but Passenger is still throwing a config.ru error:

An internal error occurred while trying to spawn the application.
Exception type: Passenger::SystemException
Error message: Cannot lstat("/web/[path]/wsgi/fm-ics/config.ru"): No such file or directory (errno=2)
Backtrace:
     in 'void Passenger::ApplicationPool2::Spawner::prepareUserSwitching(Passenger::ApplicationPool2::Spawner::SpawnPreparationInfo&, const Passenger::ApplicationPool2::Options&) const' (Spawner.h:872)
     in 'Passenger::ApplicationPool2::Spawner::SpawnPreparationInfo Passenger::ApplicationPool2::Spawner::prepareSpawn(const Passenger::ApplicationPool2::Options&) const' (Spawner.h:797)
     in 'void Passenger::ApplicationPool2::SmartSpawner::startPreloader()' (SmartSpawner.h:206)
     in 'virtual Passenger::ApplicationPool2::ProcessPtr Passenger::ApplicationPool2::SmartSpawner::spawn(const Passenger::ApplicationPool2::Options&)' (SmartSpawner.h:752)
     in 'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const Passenger::ApplicationPool2::SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)' (Implementation.cpp:804)

in fm_ics directory, passenger_wsgi.py (from PEP 333):

def simple_app(environ, start_response):

    """Simplest possible application object"""

    status = '200 OK'

    response_headers = [('Content-type', 'text/plain')]

    start_response(status, response_headers)

    return ['Hello world!\n']

Is there a config switch somewhere to tell Passenger to seek passenger_wsgi.py instead of Rails?

Thanks for your patience.

|tj


TJ Connelly

unread,
Feb 22, 2014, 1:01:04 PM2/22/14
to phusion-...@googlegroups.com
Density reduced. Thanks for your help & eyeballs.

|tj

Hongli Lai

unread,
Feb 24, 2014, 8:41:41 AM2/24/14
to phusion-passenger
Something is causing it to think that it's a Ruby app instead of a
Python app. Can you show me your configuration file? And which version
of Phusion Passenger are you using?
> https://groups.google.com/d/msgid/phusion-passenger/f1563e45-1869-4677-8760-e8501be28daf%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages