If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!

web2py with Cherokee via uWSGI: a simple, easy guide

(written specifically for Ubuntu, but applicable to all systems)

By: Evan Gray - GrayMatterComputing


I) web2py

___A) Download web2py (found at web2py.com)

______1) Install python, if not present:

sudo apt-get install python

___B) Unzip (to /var/web2py)

___C) Run:

sudo python /var/web2py/web2py.py -a desiredpassword

___D) Verify that it functions properly (by visiting localhost:8000), then close the server (Ctrl+C in terminal)

___E) Allow server permission to web2py:

sudo chown -hR www-data\: /var/web2py

______1) Where "www-data" is Cherokee's effective user (www-data is the default)

II) uWSGI

___A) Download uWSGI (found at projects.unbit.it/uwsgi/)

___B) Unpackage wherever and cd into folder

______1) Install dependencies for make, if not present:

sudo apt-get install python-dev libxml2-dev

___C) Make uwsgi:

sudo make -f Makefile.Py26

___D) Install:

sudo cp uwsgi26 /usr/local/bin/uwsgi

___E) Create config.xml:

sudo cat > /var/web2py/config.xml 

<uwsgi> 

    <pythonpath>/var/web2py/</pythonpath> 

    <app mountpoint="/"> 

    <script>wsgihandler</script> 

    </app> 

</uwsgi> 

[PRESS ENTER]

[PRESS CTRL+D]

III) Cherokee

___A) Install Cherokee (follow the instructions at cherokee-project.org)

______1) Note: I highly recommend using the PPA method so you can be sure to have the latest version and no issues!

___B) Run cherokee-admin:

sudo cherokee-admin

___C) Visit admin console (via browser, password is shown in terminal): localhost:9090

___D) Go to Virtual Servers, click Wizards, click Platforms, click uWSGI

______1) New Host Name: web2py

______2) Document Root: /var/web2py

______3) Configuration File: /var/web2py/config.xml

______4) Same logs as vserver: default(combined)

______5) Submit

___E) Go to Virtual Servers, click default

______1) Under "Basics", Virtual Server Nickname: original

___F) Go to Virtual Servers, click web2py

______1) Under "Basics", Virtual Server Nickname: default

______2) Under "Logging", verify all logging is correct (matches original)

___G) Go to Virtual Servers

______1) Set original Active to OFF

IV) Visit localhost (or your.ip.add.ress from another computer) to view your web2py site! :D

Related slices

Comments (5)

  • Login to post



  • 0
    sojin 9 years ago
    @salbefe __D: Virtual Servers -> New (top left) ____1: Select platform uwsgi and Add ____2: Configuration File: /var/web2py/config.xml ____3: Give new hostname ____4: Documentroot: /var/web2py ____5: Use same log as "default(combined)" I could see its working for http://localhost without E,F,G and its beautiful!!

  • 0
    salbefe 9 years ago
    Hello, I'm trying to setup web2py with cherokee following the steps above but It seems that the last version of cherooke (1.0.8) is a bit different from the last one. After four hours trying to start web2py with cherokee I need some help. For example, as I can see steps E,F,G are now completely different. For example, in step G, is impossible to set original active to OFF because there is not such option. Anyone could help me, please?? I'm using fedora core 13 Thanks in advance

  • 0
    dragonfyre13 9 years ago
    Something to note. You'll want to install rrdtool out of the repositories too, in order to get the neat graphs and stuff in the admin interface.

  • 0
    dragonfyre13 9 years ago
    Also, pulled from the cherokee website, you'll want to use ssl (most likely) and they instruct you to also install another package for that. sudo apt-get install libcherokee-mod-libssl You'll also have to point to the ssl key and certificate, but that was the piece I was missing, even though I had openssl done, and created the key and cert. For reference, copy and paste this to setup they key and cert also: openssl req -days 1000 -new -x509 -nodes -out /etc/cherokee/ssl/cherokee.pem -keyout /etc/cherokee/ssl/cherokee.pem

  • 0
    mrfreeze 9 years ago
    Very helpful. Thanks.

Hosting graciously provided by:
Python Anywhere