Web2py and Webfaction

84 views
Skip to first unread message

Heronim

unread,
Aug 29, 2009, 5:44:32 PM8/29/09
to web2py-users
I am installing the Web2py in WebFaction, typing the command:

python web2py.py -p12345

Is the message:

Traceback (most recent call last):
File "web2py.py", line 20, in?
gluon.widget.start (cron = True)
AttributeError: 'module' object has no attribute 'start'

What to do?

jlegler

unread,
Aug 30, 2009, 10:09:46 AM8/30/09
to web2py-users
Try running it like this:

python2.5 web2py -p 80

By default, webfaction runs python 2.4 so if you don't specify 2.5 you
may run into problems.

I had really good luck following instructions written by dhmorgan and
yarko in webfaction's forums. You can view it at
http://forum.webfaction.com/viewtopic.php?pid=8473. I have edited it
to what works for me based on what dhmorgan wrote and what yarko added
a month later. It is included below. Good luck.

-jason


Settting up Web2py as WSGI on Webfaction

Make available two subdomain names, one for adminstration, the other
for public display:
'admin.example.com'
'www.example.com'

Create a webfaction application of type "mod_wsgi 2.5/Python 2.5":
'apachewsgi'

Create two webfaction sites that :
'mysite_admin' -- https enabled; subdomain 'admin.example.com';
application 'apachewsgi' served at '/'
'mysite' -- *not* https enabled; subdomain 'www.example.com';
application 'apachewsgi' served at '/'

Get the latest web2py and copy it into ~/webapps/apachewsgi/:
cd ~/repos/svn #for example
svn checkout http://web2py.googlecode.com/svn/trunk/ web2py-read-
only
svn export web2py-read-only ~/webapps/apachewsgi/web2py

Edit ~/webapps/apachewsgi/apache2/conf/httpd.conf:
!! see listing below !!

Create admin password:
in ~/webapps/apachewsgi/web2py:
python2.5 web2py -p 80

web2py will ask you for a password, which it will then store in a
file, 'parameters_80.py'. From another terminal, kill web2py process
according to web2py's output instructions if it doesn't die on its own
from trying to set up on port 80. This is done because webfaction
gives you a port which is mod_wsgi_listener_port, to use in your
httpd.conf file; however, web2py admin is looking at the request
server_port which is port 80.

Start your app:
~/webapps/apachewsgi/apach2/bin/start

Have fun

===== START httpd.conf listing ==============================

ServerRoot "/home/[YOUR ACCOUNT]/webapps/apachewsgi/apache2"

LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule alias_module modules/mod_alias.so
LoadModule authz_host_module modules/mod_authz_host.so

KeepAlive Off
Listen [PORT SPECIFIED BY WEBFACTION]

WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
wsgihandler.py
WSGIDaemonProcess web2py user=[YOUR ACCOUNT] group=[YOUR ACCOUNT] \
home=/home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py \
processes=1 maximum-requests=1000

NameVirtualHost 127.0.0.1:[PORT SPECIFIED BY WEBFACTION]
<VirtualHost 127.0.0.1:[PORT SPECIFIED BY WEBFACTION]>
ServerName www.example.com
DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:[PORT SPECIFIED BY WEBFACTION]>
ServerName admin.example.com
DocumentRoot /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/
applications/admin
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/[YOUR ACCOUNT]/webapps/apachewsgi/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"
\
\"%{User-Agent}i\"" combined
CustomLog logs/access_log combined
ServerLimit 2

===== END httpd.conf listing ==============================

Heronim

unread,
Aug 30, 2009, 8:08:48 PM8/30/09
to web2py-users
It worked, thank you for help.

Richard

unread,
Sep 7, 2009, 9:20:48 PM9/7/09
to web2py-users
I used the above script and it worked well.
Now I have multiple web2py apps on webfaction with lots of static
files. How can I configure this so that these files are served
directory by Apache?

Richard



On Aug 31, 12:09 am, jlegler <jleg...@gmail.com> wrote:
> Try running it like this:
>
> python2.5 web2py -p 80
>
> By default,webfactionruns python 2.4 so if you don't specify 2.5 you
> may run into problems.
>
> I had really good luck following instructions written by dhmorgan and
> yarko inwebfaction'sforums.  You can view it athttp://forum.webfaction.com/viewtopic.php?pid=8473.  I have edited it
> to what works for me based on what dhmorgan wrote and what yarko added
> a month later.  It is included below.  Good luck.
>
> -jason
>
> Settting up Web2py as WSGI onWebfaction
>
> Make available two subdomain names, one for adminstration, the other
> for public display:
>     'admin.example.com'
>     'www.example.com'
>
> Create awebfactionapplication of type "mod_wsgi 2.5/Python 2.5":
>     'apachewsgi'
>
> Create twowebfactionsites that :
Reply all
Reply to author
Forward
0 new messages