Hello, here is the start of an apache config for using static files if they exist, and the person is not logged in.
The idea will be to have a www/static/cheeseshop.python.org/pypi/ directory filled with the relevant cached files. Here's the apache config so far. It checks to see if the person is authorized, and if they are it does not use the static files. There are a couple of special cases... ie the /pypi and pypi urls. Now I just need to finish off the static file generation code. It needs a tool which can run every minute or so, which will look for any changes. If it finds changes it will update just those files. It will generate the files in a separate directory first, and then move them in - so people don't download half generated files. It will optionally be able to regenerate all the static files - incase there are database, or template changes. Of course the config will have to change a little bit for using fcgi instead of modpython... but there shouldn't be too much to change. I've also updated the http://wiki.python.org/moin/CheeseShopDev page with some things I noticed when installing the cheeseshop again on my laptop. Mainly dependencies, and missing config steps. NameVirtualHost 192.168.0.3 <VirtualHost 192.168.0.3> ServerAdmin [EMAIL PROTECTED] ServerName gracerr.pretendpaper.com DocumentRoot /home/rene/dev/python/cheeseshop/packages/trunk/www/ # Redirect RSS to a static file Alias /pypi/?:action=rss /data/www/pypi/pypi_rss.xml <Directory /home/rene/dev/python/cheeseshop/packages/trunk/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> AddHandler cgi-script .cgi <Directory /data/packages/> Options Indexes </Directory> <Location /pypi2> SetHandler mod_python #PythonPath "['/data/pypi/src/pypi']+sys.path" PythonPath "['/home/rene/dev/python/cheeseshop/packages/trunk/pypi']+sys.path" PythonHandler pypi::handle PythonDebug On # 2007-06-15 -- POSTs to /pypi every second deny from 69.55.232.188 </Location> # Rewrite rules RewriteEngine on # if the authorization header is empty, redirect. RewriteCond %{HTTP:authorization} ^$ RewriteRule ^(.*)pypi/$ /static/package_index.html [L] #RewriteRule ^(.*)pypi$ /static/front-page.html [L] # always make the /pypi empty one go straight through. RewriteRule ^(.*)pypi$ /pypi2 [PT] # a file, or a directory, and empty authorization header. RewriteCond %{HTTP:authorization} ^$ RewriteCond /home/rene/dev/python/cheeseshop/packages/trunk/www/static/gracerr.pretendpaper.com/%{REQUEST_FILENAME} -f RewriteRule ^(.*)pypi/(.*) /static/gracerr.pretendpaper.com/pypi/$2 [PT] RewriteCond %{HTTP:authorization} ^$ RewriteCond /home/rene/dev/python/cheeseshop/packages/trunk/www/static/gracerr.pretendpaper.com/%{REQUEST_FILENAME} -d RewriteRule ^(.*)pypi/(.*) /static/gracerr.pretendpaper.com/pypi/$2 [PT] # Look here instead... RewriteRule (.*) /pypi2/$1 [PT] # Point to package directory RewriteRule /packages(/.*)?$ /data/packages$1 [last] RewriteRule /icons/(.*$) /usr/share/apache2/icons/$1 [last] RedirectMatch permanent ^/$ "http://gracerr.pretendpaper.com/pypi" RewriteLog /var/log/apache2/rewrite.log RewriteLogLevel 9 ErrorLog /var/log/apache2/grace_error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. #LogLevel warn LogLevel debug CustomLog /var/log/apache2/grace_access.log combined #ServerSignature On # mkdir /var/tmp/proxy2/cheeseshop # chown www-data: /var/tmp/proxy2/cheeseshop # CacheRoot "/var/tmp/proxy2/cheeseshop" # CacheEnable disk / # CacheSize 4000000 # # CacheMinFileSize setting this so that 403 forbidden pages are not cached. # CacheMinFileSize 400 # CacheDirLevels 5 # CacheDirLength 3 # #CacheGcInterval 4 # CacheMaxExpire 24 # CacheLastModifiedFactor 0.1 # CacheDefaultExpire 1 # #CacheForceCompletion 100 </VirtualHost> _______________________________________________ Catalog-SIG mailing list [email protected] http://mail.python.org/mailman/listinfo/catalog-sig
