Thanks for this great guide Ivan, you saved me hours of configuration time and I learned a lot.
On Mar 2, 1:35 am, Ivan P <ivanv...@gmail.com> wrote: > Make that rule "^/app/static" > > On Mar 2, 1:29 am, Ivan P <ivanv...@gmail.com> wrote: > > > Could you elaborate? You want those two rules to point to a static > > folder? > > If that is the case, you would probably add a new regex rule with > > something like "^/app/static$", and add a "static" handler to that > > rule, and for the handler just pick the directory where the static > > files are. > > > On Feb 27, 1:10 am, Thadeus <thade...@thadeusb.com> wrote: > > > > What if I want > > > > example.com/app/static > > > example.com/app2/static > > > > What exact rule do I use for this situation? > > > > On Feb 24, 12:37 am, GrayMatterComputing <battledi...@gmail.com> > > > wrote: > > > > > Open theCherokeeAdmin -> General -> Server Permissions. There you > > > > are :) > > > > > Cherokeewill respond in the priority order you have set for the > > > > virtual servers and behaviors. It will evaluate only the first rule in > > > > the list that matches. For example, if you had a static content rule > > > > for the directory "/static" and web2py was the default, a request for > > > > "example.com/stuff" would pass to web2py, while "example.com/static/ > > > > stuff" would be evaluated by the static content rule. > > > > > On Feb 22, 2:40 pm, Thadeus Burgess <thade...@thadeusb.com> wrote: > > > > > > How do you tell what usercherokeegets executed as when the server > > > > > boots up? > > > > > > In my typical installation I have a generic user account (like > > > > > "servant") that everything server related exists in this home > > > > > directory, and it owns everything. With Apache I have to chown/mod the > > > > > files so that www-data can read them. > > > > > > I need to use a user account instead of www-data since mercurial is > > > > > involved. > > > > > > As far as static file streaming, doescherokeeintercept web2py file > > > > > serving? > > > > > > Is there a way to tellcherokeeto serve all requests to the "static" > > > > > folder without even going through web2py? > > > > > > -Thadeus > > > > > > On Fri, Feb 5, 2010 at 4:45 AM, Ivan P <ivanv...@gmail.com> wrote: > > > > > > Sorry for the delayed response. > > > > > > I think that usually means that your permissions are not set. Make > > > > > > sure thatuwsgiis running under the same user that owns your web2py > > > > > > directory. The error is unknown cause web2py cannot open the error > > > > > > file, because it cannot write it to disc. > > > > > > > On Jan 27, 3:56 pm, Adi <aditya.sa...@gmail.com> wrote: > > > > > >> Hi Ivan, > > > > > > >> I followed this howto, and when I try to access the application I > > > > > >> get > > > > > >> an internal error thrown by web2py: > > > > > >> Ticket issued: unknown > > > > > > >> Any idea how to read contents of this ticket to debug? > > > > > > >> On Jan 15, 3:14 am, Ivan P <ivanv...@gmail.com> wrote: > > > > > > >> > Inspired by Phyo Arkar's howto on setting up web2py > > > > > >> > withCherokeeand > > > > > >> > FCGI I tried the setup, but was somewhat unsatisfied with the > > > > > >> > fcgi > > > > > >> > method and decided to tryuWSGI. I am happy I did so, since it > > > > > >> > proved > > > > > >> > to be real easy anduWSGIis a real powerhouse and deserves > > > > > >> > attention > > > > > >> > of the whole python webdev community. On to the howto. > > > > > > >> > I. Compile from source and run the latestuWSGI, 0.9.3 in my case > > > > > >> > (available herehttp://projects.unbit.it/uwsgi/wiki). > > > > > >> > 1. Download the source from and unzip. > > > > > > >> > 2. To compile you must install packages python-dev and > > > > > >> > libxml2-dev (at > > > > > >> > least thats what they are called on a debian-based system) > > > > > > >> > 3. When compiling simply run pick a makefile which matches your > > > > > >> > OS and > > > > > >> > python version and run something like "make -f > > > > > >> > Makefile.Linux.Py26". > > > > > >> > This produces only one executable named uwsgi26, where 26 is my > > > > > >> > python > > > > > >> > version. You can put it in /usr/local/bin. > > > > > > >> > 5. To run it, you have two options: > > > > > > >> > 5a) Create an xml file and call it, for example, config.xml. Put > > > > > >> > something like this in it: > > > > > >> > <uwsgi> > > > > > >> > <pythonpath>/var/web2py/</pythonpath> > > > > > >> > <app mountpoint="/"> > > > > > >> > <script>wsgihandler</script> > > > > > >> > </app> > > > > > >> > </uwsgi> > > > > > >> > In this file "pythonpath" is where your web2py directory is and > > > > > >> > "script" is the file you want to run, in this case its web2py's > > > > > >> > "wsgihandler.py". Now runuWSGIlike this, but replace "www-data" > > > > > >> > with > > > > > >> > the owner of your web2py directory, if its the same as your > > > > > >> > current > > > > > >> > user omit the sudo command: > > > > > >> > sudo -u www-data uwsgi26 -s /tmp/uwsgi.sock -C -x config.xml > > > > > >> > Why you need to change user is because web2py writes things > > > > > >> > (session > > > > > >> > data for example) to disc during execution, so theuwsgiprocess, > > > > > >> > which runs the web2py code, has to be the owner of the > > > > > >> > directories > > > > > >> > that contain the framework. Note thatuwsginow opened a socket we > > > > > >> > called "/tmp/uwsgi.sock" About other options consult > > > > > >> > theuwsgimanual > > > > > >> > or "uwsgi-h". > > > > > > >> > 5b) You can omit the xml file and pass all the info via command > > > > > >> > line, > > > > > >> > doing that is easy, so consult theuwsgidocs :) > > > > > > >> > II. Setting upcherokee(0.99.37 in my case). > > > > > >> > 1. Install it, runcherokee-admin, go to localhost:9090 > > > > > > >> > 2. Open "Information Sources" and create a new one with these > > > > > >> > parameters: > > > > > >> > Nick: web2py > > > > > >> > Connection: /tmp/uwsgi.sock > > > > > >> > Interpreter: uwsgi26 -s /tmp/uwsgi.sock -C -x /path/to/config.xml > > > > > >> > The interpreter line is why it is a good idea to have your web2py > > > > > >> > source owned by www-data or theCherokeeserver's user - > > > > > >> > whencherokee > > > > > >> > runs it, you can be sure that owners of the sources and process > > > > > >> > match. > > > > > >> > And of course put the correct path in. > > > > > > >> > 3. Go to "Virtual Servers" and edit the default one, or you can > > > > > >> > create > > > > > >> > a new one, but make sure you give it a domain name to avoid > > > > > >> > conflict > > > > > >> > (not really sure what happens when they conflict). > > > > > > >> > 4. Go to the "Behavior" section and edit the "Default" behavior. > > > > > > >> > 5. Set the "Handler" touWSGIand on the bottom set the information > > > > > >> > source to "web2py" > > > > > > >> > 6. Pick "Hard restart" from the dropdown on the left and click > > > > > >> > "Save". > > > > > >> > TO PREVENT HEADACHE READ THIS: I seem to get inconsistent > > > > > >> > results with > > > > > >> > these restarts, so if you're doing production it seems to me > > > > > >> > that one > > > > > >> > should restart the server manualy (via > > > > > >> > /etc/init.d/cherokeerestart, > > > > > >> > that is). Or maybe I should RTFM. > > > > > > >> > 6. Go to localhost and BAM! (or at least I hope its a bam). > > > > > >> > veeery > > > > > >> > easy if all goes smooth. > > > > > > >> > "But wait, what about url rewriting?" was my thought, and this > > > > > >> > caused > > > > > >> > much confusion, so I'll add a section on that. > > > > > > >> > III. Doing some redirection (I'll give few examples due to poor > > > > > >> > knowledge of regex). > > > > > >> > Lets redirect "localhost/" to "/myapp/cntrlr/index" > > > > > >> > 1. Go back to the "Behavior" section of your server. > > > > > > >> > 2. Add a new rule and set it's type to "Regular Expression" and > > > > > >> > set > > > > > >> > the regular expression to "^/$", this simply matches > > > > > >> > "localhost/" or > > > > > >> > "localhost", nothing more, nothing less. > > > > > > >> > 3. Go to the "Handler" section and set the rule to "Redirect" > > > > > >> > with > > > > > >> > these parameters > > > > > >> > Type: Internal > > > > > >> > Regular Expression: (yes, blank) > > > > > >> > Substitution: /myapp/cntrlr/index > > > > > >> > The regular expression is blank because for this scenario we did > > > > > >> > all > > > > > >> > the matching while defining a new behavior, you can combine the > > > > > >> > two in > > > > > >> > creative ways. > > > > > > >> > That's about all. Your imagination should take care of the rest. > > > > > >> > I, > > > > > >> > for example, put my static files separately from the framework by > > > > > >> > creating a behavior that points to "/static" and picking "static > > > > > >> > files" as the handler. > > > > > >> > Thanks to Massimo DiPierro for web2py and Phyo Arkar for > > > > > >> > hischerokee > > > > > >> > howto. > > > > > >> > I'm not much of a writer so feel free to ask for clarifications. > > > > > > > -- > > > > > > 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+unsubscr...@googlegroups.com. > > > > > > For more options, visit this group > > > > > > athttp://groups.google.com/group/web2py?hl=en.