Today I finally got around to setting up Apache to serve static
resources instead of Pylons/Paste. It seems to be making a pretty big
difference in how fast the site loads, even though the site is not
heavily loaded. It's currently getting about 50,000 page views and
about 300,000 hits to static resources per month.

Below is the complete and unvarnished VirtualHost container I'm using
in a production environment (I did obfuscate some things for
"security" purposes). I marked the new lines with ## at the end.
Otherwise, I didn't change anything in my Apache config.

In my app, I made one tiny change in middleware.py and that's it
(noting that I already had `debug` set from current.ini in
`app_globals`):

    if g.debug:  # Added this and indented the following lines
        static_app = StaticURLParser(config.paths['static_files'])
        javascripts_app = StaticJavascripts()
        app = Cascade([static_app, javascripts_app, app])

<VirtualHost *:80>
    ServerAdmin [EMAIL PROTECTED]
    ServerName tripplanner.bycycle.org
    ServerAlias www.tripplanner.bycycle.org

    DocumentRoot /home/fakeuser/fake/path/to/my/pylons/app/public  ##

    ProxyRequests Off
    <Proxy http://127.0.0.1:65535/*>
        Order deny,allow
        Allow from all
    </Proxy>

    ProxyPass /images !  ##
    ProxyPass /javascripts !  ##
    ProxyPass /stylesheets !  ##
    ProxyPass /favicon.ico !  ##
    ProxyPass /robots.txt !  ##
    ProxyPass / http://127.0.0.1:65535/
    ProxyPassReverse / http://127.0.0.1:65535/

    ErrorLog logs/tripplanner.bycycle.org-error_log
    CustomLog logs/tripplanner.bycycle.org-access_log combined

    # ErrorDocument 503 "<h1>Upgrade in Progress</h1><p>The Trip
Planner is being upgraded. Please try back in about 15 - 30 minutes.
Thanks, <a href=\"http://byCycle.org/\";>byCycle.org</a>.</p>"
</VirtualHost>


__wyatt


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to