Dream Host Deployment

39 views
Skip to first unread message

Jesse

unread,
Mar 3, 2010, 12:20:30 AM3/3/10
to web2py-users
Hello, I've been trying to set up web2py on my dreamhost account.
I've searched the web over trying to find something that works finally
found:
http://www.web2pyslices.com/main/slices/take_slice/1

Which I effective followed save that I used different directory (/opt
instead of /local) and installed python 2.55 instead of virtualenv. I
don't think that is terribly import but I could be wrong.

Regardless, as far as I can tell I made it all the way through,
however when I go to the site I get:
An error occurred importing your passenger_wsgi.py

Unfortunately, I'm no expert on wsgi and the like so I'm at a loss at
what to do next to figure out the issue.

Jesse

unread,
Mar 3, 2010, 9:58:39 PM3/3/10
to web2py-users
I tried running the python code from the passenger_wsgi.py manually to
see if there were any issues.

When I got down to
import gluon.main
I got:
WARNING:root:unable to import dbhash
issues???

My passenger_wsgi.py / wsgihandler.py code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
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

"""

import sys
import os
INTERP = "/home/jesdavid/opt/bin/python2.5"
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.arg)
sys.path.insert(0, '')
path = os.path.dirname(os.path.abspath(__file__))
if not path in sys.path:
sys.path.append(path)
os.chdir(path)

import gluon.main
from gluon.contrib.wsgihooks import ExecuteOnCompletion2, callback

application = ExecuteOnCompletion2(gluon.main.wsgibase, callback)

mr.freeze

unread,
Mar 4, 2010, 2:05:02 AM3/4/10
to web2py-users
I just went through the setup again (with virtualenv though) and it
worked like a charm. It must be related to your python install. What
happens if you open a python shell and type 'import dbhash'?

rppowell

unread,
Mar 4, 2010, 3:27:52 AM3/4/10
to web2py-users
I use Dreamhost but I got things working with FastCGI.

I have documented the steps here: http://www.web2pyslices.com/main/slices/take_slice/68

This is not the best/only way to do it, but I got it working (and in a
sub-directory/sub-url too).
-rppowell

Jesse

unread,
Mar 4, 2010, 11:45:13 AM3/4/10
to web2py-users
Using virtualenv seemed to do the trick.

Although, I'm sure it doesn't matter now when I ran "import dbhash" I
got a several line long error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/username/opt//lib/python2.5/dbhash.py", line 5, in
<module>
import bsddb
File "/home/username/opt//lib/python2.5/bsddb/__init__.py", line 51,
in <module>
import _bsddb
ImportError: No module named _bsddb


Another question: Any tips on getting into the Admin screens via
https? or at least without removing the security.
I'm guessing something like a self signed key will likely work, but
I'm unfamiliar.
I found:
http://web2py.com/AlterEgo/default/show/140
http://web2py.com/AlterEgo/default/show/143

I haven't tried either yet, but I hate running stuff without really
knowing what they're supposed to do since you can end up doing
unforeseen things.

Jesse

unread,
Mar 4, 2010, 11:01:56 PM3/4/10
to web2py-users
Looks like setting up self signed SSL on dreamhost requires a unique
IP (for extra $) which I'm not exactly up for just to learn web2py
(yes I know I can run it on my own computer).

As for I believe doing an SSH tunnel I don't entirely see how that
would let me log into the admin pages.

Any other ways?

On Mar 4, 12:45 pm, Jesse <joda...@gmail.com> wrote:
> Using virtualenv seemed to do the trick.
>
> Although, I'm sure it doesn't matter now when I ran "import dbhash" I
> got a several line long error:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/home/username/opt//lib/python2.5/dbhash.py", line 5, in
> <module>
>     import bsddb
>   File "/home/username/opt//lib/python2.5/bsddb/__init__.py", line 51,
> in <module>
>     import _bsddb
> ImportError: No module named _bsddb
>
> Another question: Any tips on getting into the Admin screens via
> https? or at least without removing the security.
> I'm guessing something like a self signed key will likely work, but
> I'm unfamiliar.

> I found:http://web2py.com/AlterEgo/default/show/140http://web2py.com/AlterEgo/default/show/143

Thadeus Burgess

unread,
Mar 4, 2010, 11:19:36 PM3/4/10
to web...@googlegroups.com
When I ran web2py on dreamhost I just edited my admin application and
removed the checks for https.

Of course your best option is to use a ssh tunnel, forward the port 80
of the server to your local port 8080 or something, since admin allows
any localhost connections to access it will work.

-Thadeus

> --
> You received this message because you are subscribed to the Google Groups "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to web2py+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
>
>

Jesse

unread,
Mar 6, 2010, 4:58:47 PM3/6/10
to web2py-users
Yeah, that either of those sound like what I'll have to do.

I tried the ssh tunnel, but it didn't seem to have much effect:
ssh -L 80:web2py.mydomain.com:8080 lo...@dreamhost.com
ssh -L 8080:localhost:80 lo...@dreamhost.com
[and various other permutations]
I then tried going to localhost:8080 and got nada

Clearly my shellFu is not up to snuff but I would think one of my
guesses would have worked.

I guess I'll just cripple the security, since it's not exactly a big
deal if my testing site gets hacked anyway.

Jesse

On Mar 5, 12:19 am, Thadeus Burgess <thade...@thadeusb.com> wrote:
> When I ran web2py  on dreamhost I just edited my admin application and
> removed the checks for https.
>
> Of course your best option is to use a ssh tunnel, forward the port 80
> of the server to your local port 8080 or something, since admin allows
> any localhost connections to access it will work.
>
> -Thadeus
>

> On Thu, Mar 4, 2010 at 10:01 PM, Jesse <joda...@gmail.com> wrote:
> > Looks like setting up self signed SSL on dreamhost requires a unique
> > IP (for extra $) which I'm not exactly up for just to learn web2py
> > (yes I know I can run it on my own computer).
>
> > As for I believe doing an SSH tunnel I don't entirely see how that
> > would let me log into the admin pages.
>
> > Any other ways?
>
> > On Mar 4, 12:45 pm, Jesse <joda...@gmail.com> wrote:
> >> Using virtualenv seemed to do the trick.
>
> >> Although, I'm sure it doesn't matter now when I ran "import dbhash" I
> >> got a several line long error:
> >> Traceback (most recent call last):
> >>   File "<stdin>", line 1, in <module>
> >>   File "/home/username/opt//lib/python2.5/dbhash.py", line 5, in
> >> <module>
> >>     import bsddb
> >>   File "/home/username/opt//lib/python2.5/bsddb/__init__.py", line 51,
> >> in <module>
> >>     import _bsddb
> >> ImportError: No module named _bsddb
>
> >> Another question: Any tips on getting into the Admin screens via
> >> https? or at least without removing the security.
> >> I'm guessing something like a self signed key will likely work, but
> >> I'm unfamiliar.

> >> I found:http://web2py.com/AlterEgo/default/show/140http://web2py.com/AlterEgo...

Kuba Kucharski

unread,
Mar 6, 2010, 6:04:46 PM3/6/10
to web...@googlegroups.com
let's get you through it.

for development I use two instances of web2py.

one:

python web2py.py -i public_ip -p 80 -a ""

two:

python web2py.py -i public_ip -p 8001 -a "password"

one instance serves my beta testers and users, the second on runs just for me

then I do:

ssh -L 8001:127.0.0.1:8001 kuba@server

and type 127.0.0.1:8001 in my browser. I promise you it will work.

the first "8001" is my local port on my desktop
the :127.0.0.1:8001 part is where I estabilished my web2py instance on
the server. that is all.

happy hacking.

--
Kuba

Jesse

unread,
Mar 6, 2010, 9:33:16 PM3/6/10
to web2py-users
Fabulous,

That seemed to do the tricked.

Dreamhost seems to be a bit touchy on which ports you I can use to run
web2py on. (ie none of 8000, 8001, 8080, 8081, etc seemed to work)
But I just picked a random number and it seems to work like a charm.

I'll have to add this to Dreamhost's wiki.

Thanks a bunch,
Jesse

Jesse

unread,
Mar 6, 2010, 10:05:19 PM3/6/10
to web2py-users
I put the update on:

http://wiki.dreamhost.com/Web2py

For anyone that is interested.

Also, I can migrate the info to another location if someone has a
suggestion as to where.


Cheers,
Jesse

Jason Brower

unread,
Mar 7, 2010, 12:56:29 AM3/7/10
to web...@googlegroups.com
I wonder if this could be something that could be added to the web2py
book as dreamhost is a big company. Maybe dreamhost would be willing to
pay a little to have it done. :P
BR,
Jason

Frank Church

unread,
Mar 7, 2010, 5:58:46 PM3/7/10
to web...@googlegroups.com
Unless you are on a Private Server you will not be able to use other
ports besides port 80 nor should you be able to.

Dreamhost IS shared hosting. An non standard ports are killed by
Dreamhost once they are spotted

> --
> You received this message because you are subscribed to the Google Groups "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to web2py+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/web2py?hl=en.
>
>

--
Frank Church

=======================
http://devblog.brahmancreations.com

Kuba Kucharski

unread,
Mar 8, 2010, 10:39:39 AM3/8/10
to web...@googlegroups.com
yes, there is a mistake in my recipe

should be:

python web2py.py -i 127.0.0.1 -p 8001 -a "password"

not:

python web2py.py -i public_ip -p 8001 -a "password"


here is a slice:

http://www.web2pyslices.com/main/slices/take_slice/71

--
Kuba

mdipierro

unread,
Mar 8, 2010, 12:41:53 PM3/8/10
to web2py-users
Or

python web2py.py -i 0.0.0.0 -p 8001 -a "password"

for all public IPs

Jesse

unread,
Mar 8, 2010, 2:27:11 PM3/8/10
to web2py-users
Unfortunately, none of those work.

Result from using pretty much any of the above:

$ python web2py.py -i 0.0.0.0 -p 8001 -a "password"
The profile/pstats modules cannot be found
Please install the python-profiler package
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2010
Version 1.76.3 (2010-03-03 16:58:56)
Database drivers available: SQLite3, MySQL
Starting cron...
please visit:
http://0.0.0.0:8001
use "kill -SIGTERM 14723" to shutdown the web2py server


Traceback (most recent call last):

File "web2py.py", line 20, in <module>
gluon.widget.start(cron=True)
File "/home/user/web2py.domain.com/gluon/widget.py", line 860, in
start
server.start()
File "gluon/main.py", line 773, in start
self.server.start()
File "gluon/wsgiserver.py", line 1879, in start
raise socket.error(msg)
socket.error: (98, 'Address already in use')

mr.freeze

unread,
Mar 8, 2010, 2:29:27 PM3/8/10
to web2py-users
Port 9009 works for me and has the added bonus of being a palindrome.
Reply all
Reply to author
Forward
0 new messages