Posts Tagged passenger
Serving django media files from the same host as the passenger app server
Posted by Adam in Programming, Python on Monday September 20, 2010
WARNING: Please read before continuing ▼
Difficulty: Easy
Time: ~5 Minutes
Last Updated: 20rd September 2010
Applies to: *NIX
The recommended configuration for django is to have any static files, such as script, CSS or images uploaded onto a CDN network. While this is the best configuration for a large site, for toy applications it is overkill.
Also, you may wish to run your development environment using passenger, rather than using manage.py runserver.
To start, we need to make a media directory in your passenger app root, and then create a symbolic link to the admin media files located on your system.
1 2 3 | cd /var/www mkdir media #the directory where our media files will be stored ln -s /usr/lib/pymodules/python2.6/django/contrib/admin/media/ admin_media |
Next, we need to disable passenger on the directories/symlinks we have created, as per the previous article on the blog.
Once this is done, edit settings.py in your django app, specifying the new addresses for your media.
Finally, restart apache, and you should now be able to access the media files you need.
Serving non-python files from a subdirectory of the passenger root.
Posted by Adam in PHP, Programming, Python on Wednesday September 15, 2010
WARNING: Please read before continuing ▼
Difficulty: Easy
Time: ~5 Minutes
Last Updated: 23rd September 2010
Applies to: *NIX
Serving non-python or ruby files from a subdirectory below the passenger app root requires a simple change to the site configuration.
Open it up, and add something similar to this under the VirtualHost entry (this example shows the subdirectory phpPgAdmin being disabled, so that phpPgAdmin can be served by php instead):
1 2 3 4 | Alias /phpPgAdmin /var/www/phpPgAdmin <Location /phpPgAdmin> PassengerEnabled off </Location> |
Once this is done, restart php and any requests made to yourdomain.com/phpPgAdmin will not be served by passenger.