Dreamhost Web2py (Python) deployment issue

109 views
Skip to first unread message

Samuel Sowah

unread,
Aug 21, 2014, 10:07:20 PM8/21/14
to
I followed instructions given me here for deploying web2py on dreamhost. I didn't encounter any errors at any step of the way, but when I tried opening the web page at my domain, it just keeps loading forever, then all of a sudden a web application could not be started page slaps me in the face. I get this message at the top of the page

An error occurred while starting the web application: it did not write a startup response in time. Please read this article for more information about this problem.

Raw process output:

!> Ready
!> socket: main;unix:/tmp/passenger.1.0.22131/generation-1/backends/wsgi.17327;session;1
!>

what could be the problem and how do i resolve it?

Hongli Lai

unread,
Aug 22, 2014, 6:19:01 AM8/22/14
to phusion-passenger
How does your passenger_wsgi.py look like?
> what could be the problem and how do i solve it?
>
> --
> 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/ef3ed455-7ceb-4641-b7af-54975d5fba7e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Phusion | Web Application deployment, scaling, and monitoring solutions

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

Samuel Sowah

unread,
Aug 22, 2014, 6:47:39 AM8/22/14
to phusion-...@googlegroups.com, hon...@phusion.nl
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdip...@cs.depaul.edu>


This is a WSGI handler for Apache
Requires apache+mod_wsgi.

In httpd.conf put something like:

    LoadModule wsgi_module modules/mod_wsgi.so
   WSGIScriptAlias / /path/to/wsgihandler.py

"""

# change these parameters as required
LOGGING = False
SOFTCRON = False

import sys
import os
INTERP = '/home/myusername/env/web2py-env/bin/python2.7'
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
path = '/home/myusername/official-notebook.com/web2py'
os.chdir(path)

if not os.path.isdir('applications'):
   raise RuntimeError('Running from the wrong folder')

sys.path = [path] + [p for p in sys.path if not p == path]

sys.stdout = sys.stderr

import gluon.main

if LOGGING:
   application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
                                       logfilename='httpserver.log',
                                       profiler_dir=None)
else:
   application = gluon.main.wsgibase

if SOFTCRON:
   from gluon.settings import global_settings
   global_settings.web2py_crontype = 'soft'


Hongli Lai

unread,
Aug 22, 2014, 6:51:11 AM8/22/14
to phusion-passenger
On Fri, Aug 22, 2014 at 12:47 PM, Samuel Sowah <saso...@gmail.com> wrote:
> INTERP = '/home/myusername/env/web2py-env/bin/python2.7'
> if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)

This line is the problem. This was a hack used in the Phusion
Passenger 3 days to ensure that your app is run under a specific
Python interpreter. We no longer support this hack in Phusion
Passenger 4, and the official way to run your app under a specific
Python interpreter is by using the PassengerPython config option.

Samuel Sowah

unread,
Aug 22, 2014, 6:58:09 AM8/22/14
to phusion-...@googlegroups.com, hon...@phusion.nl
How do I fix that?

Hongli Lai

unread,
Aug 22, 2014, 7:01:13 AM8/22/14
to phusion-passenger
As I've stated, you need to use the PassengerPython config option. Set
it in your Apache configuration file. Here is the documentation for
that option: https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#_passengerpython_lt_filename_gt
> --
> 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/ee92dffa-9fcc-4ac7-9224-72c4ae126778%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



Samuel Sowah

unread,
Aug 23, 2014, 1:41:28 PM8/23/14
to phusion-...@googlegroups.com, hon...@phusion.nl
made the changes, still facing the same issue. what does this mean though/

Raw process output:

!> Ready
!> socket: main;unix:/tmp/passenger.1.0.26057/generation-0/backends/wsgi.26544;session;1
!>

this is what my passenger_wsgi.py looks like now
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdip...@cs.depaul.edu>


This is a WSGI handler for Apache
Requires apache+mod_wsgi.

In httpd.conf put something like:

    LoadModule wsgi_module modules/mod_wsgi.so
    WSGIScriptAlias / /path/to/wsgihandler.py

"""

# change these parameters as required
LOGGING = False
SOFTCRON = False

import sys
import os

path = '/home/myusername/official-notebook.com/web2py/'
os.chdir(path)

if not os.path.isdir('applications'):
    raise RuntimeError('Running from the wrong folder')

sys.path = [path] + [p for p in sys.path if not p == path]

sys.stdout = sys.stderr

import gluon.main

if LOGGING:
    application = gluon.main.appfactory(wsgiapp=gluon.main.wsgibase,
                                        logfilename='httpserver.log',
                                        profiler_dir=None)
else:
    application = gluon.main.wsgibase

if SOFTCRON:
    from gluon.settings import global_settings
    global_settings.web2py_crontype = 'soft'

the domain is official-notebook.com. please do check it out and help me fix this problem.

Hongli Lai

unread,
Aug 23, 2014, 3:04:34 PM8/23/14
to phusion-passenger
Did you remove any *.pyc files on the server? Otherwise your change
might not be picked up.
> https://groups.google.com/d/msgid/phusion-passenger/40205ddf-6718-4bc7-99da-50611fab4baf%40googlegroups.com.

Samuel Sowah

unread,
Aug 23, 2014, 4:58:19 PM8/23/14
to
I removed the passenger_wsgi.pyc file, edited the PassengerPython in my httpd.conf file to "PassengerPython python"
<IfModule mod_passenger.c>


PassengerEnabled Off
PassengerRoot /dh/passenger
PassengerMaxPoolSize 4
PassengerPoolIdleTime 1200
PassengerMaxPreloaderIdleTime 3600
PassengerMaxInstancesPerApp 2
PassengerMaxRequests 400
PassengerRuby /usr/bin/ruby1.8
PassengerPython python

</IfModule>


same result

!> Ready
!> socket: main;unix:/tmp/passenger.1.0.29231/generation-0/backends/wsgi.5541;session;1
!> 


is there another way?

P.S I tried both PassengerEnabled Off and PassengerEnabled On

Hongli Lai

unread,
Aug 24, 2014, 4:50:24 AM8/24/14
to phusion-passenger

Not 'PassengerPython python'. In your old code with the INTERP command, you were specifically trying to use /home/myusername/env/web2py-env/bin/python2.7 as Python interpreter. So you need to specify 'PassengerPython /home/myusername/env/web2py-env/bin/python2.7'.

Sent from my Android phone.

On Aug 23, 2014 10:58 PM, "Samuel Sowah" <saso...@gmail.com> wrote:
I removed the passenger_wsgi.pyc file, edited the PassengerPython in my httpd.conf file to "PassengerPython python"
<IfModule mod_passenger.c>


PassengerEnabled Off
PassengerRoot /dh/passenger
PassengerMaxPoolSize 4
PassengerPoolIdleTime 1200
PassengerMaxPreloaderIdleTime 3600
PassengerMaxInstancesPerApp 2
PassengerMaxRequests 400
PassengerRuby /usr/bin/ruby1.8
PassengerPython python

</IfModule>


same result

!> Ready
!> socket: main;unix:/tmp/passenger.1.0.29231/generation-0/backends/wsgi.5541;session;1
!> 


is there another way.



On Saturday, 23 August 2014 19:04:34 UTC, Hongli Lai wrote:
Reply all
Reply to author
Forward
0 new messages