Re: Future of serving static content with pylons

2007-07-10 Thread voltron

Thank you Mike and Jose for your answers.

@ Mike

Where was the 'static'  follder situated on your file system? Is it on
another drive? My Apache server is on drive C:and all my pylons
projects live on  D:. Actually I have had that to work well for
templates, I create alternate directories for them and I add them to
the list, that works, the only difference is that the Pylon project
and the new template directoty are on the same disc.

@Jose

I have actually tried that out. As I mention, that works well on
Linux. Are you using Vhosts as well on windows? This is what my config
looks like. As yu see, I have tried both absolute paths, and it still
did not work as expected. The Apache version is 2.2.4. Pylons 0.95


VirtualHost *
ServerName localhost
#UseCanonicalName Off

#C:/xampp/apache/htdocs
# D:/Projects/Pylons_projects/testapp/testapp/public
DocumentRoot /
ProxyRequests Off

ProxyPass / http://localhost:5000
ProxyPassReverse / http://localhost:5000

ProxyPass /css !
ProxyPass /flash !
ProxyPass /img !
ProxyPass /scripts !
ProxyPass /games !
ProxyPass /favicon.ico !
ProxyPass /public !

ErrorLog logs/test-error_log
CustomLog logs/test-access_log combined

Proxy *
Order deny,allow
Allow from all
/Proxy

Location /balancer-manager
SetHandler balancer-manager

Order Deny,Allow
Deny from all
Allow from all
/Location
/VirtualHost


On Jul 10, 6:24 am, Jose Galvez [EMAIL PROTECTED] wrote:
 Dear Voltron,
 I just tested the whole proxypass thing on my windows box and it works
 as expected.  Looking at your apache confg code below the only thing I
 see is that DocumentRoot is set incorrectly, if that is really how you
 have it set that may be the problem.  I believe it needs to be set to
 the actual directory  which should be something like

 DocumentRoot C:/Program Files/Apache Software Foundation/Apache2.2/htdocs

 If that fails, maybe some info would help, what version of apache are
 you using?
 Jose

 voltron wrote:

  Why doesn't it work on Windows?

  I´m not sure, exactly why, but even when I do this in my Apache
  config:

  DocumentRoot /
 ProxyRequests Off

 ProxyPass /css !
 ProxyPass /flash !
 ProxyPass /img !
 ProxyPass /scripts !
 ProxyPass /games !
 ProxyPass /favicon.ico !

 ProxyPass /http://localhost:5000
 ProxyPassReverse /http://localhost:5000

  The same configuration, using the real domain name works on my Linux
  Server, on windows, my development workstation, it fails, all the
  templates render without the static content

  I have a symbolic link in my public directory pointing to a large
  directory of static files.  Not that this addresses your exact
  situation.

  I have read of ways to create symbolic links on windows, but in case
  of pylons, it feels like a hack, it would be cool just  to modify the
  configuration for development on any os, and when its time to deploy
  jszt change the setting or use a different ini file for production, as
  it was meant to be. Everything else is sort of hackish

  Do you have to serve the files through Pylons (e.g., for
  authentication or logging)?  What about serving them directly via
  Apache (an Alias directive or ProxyPass /pubic !)?

  Hmm, I ´ll try using that.

  Thanks

  --
  Mike Orr [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-10 Thread Mike Orr

On 7/10/07, voltron [EMAIL PROTECTED] wrote:

 Thank you Mike and Jose for your answers.

 @ Mike

 Where was the 'static'  follder situated on your file system? Is it on
 another drive?

It's inside the Pylons project so it's version controlled.  And I
haven't used Pylons on Windows.  The fact that there's still *another*
problem running applications on Windows that run fine on Linux make me
disinclined to.

Does os.path.join really ignore drive-absolutes?  I thought it was
smarter than that.

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-10 Thread voltron

According to the docs, os.path.join does throw the drive letters away:

http://docs.python.org/lib/module-os.path.html

I still think that it would be cool if there was a platform
independent way in Pylons for doing this. Another thing, it would also
be nice if one could use several static paths instead of one, just
like the templates dict.

Could the Pylons developers  comment on this?

Thanks

On Jul 10, 5:45 pm, Mike Orr [EMAIL PROTECTED] wrote:
 On 7/10/07, voltron [EMAIL PROTECTED] wrote:



  Thank you Mike and Jose for your answers.

  @ Mike

  Where was the 'static'  follder situated on your file system? Is it on
  another drive?

 It's inside the Pylons project so it's version controlled.  And I
 haven't used Pylons on Windows.  The fact that there's still *another*
 problem running applications on Windows that run fine on Linux make me
 disinclined to.

 Does os.path.join really ignore drive-absolutes?  I thought it was
 smarter than that.

 --
 Mike Orr [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-10 Thread Philip Jenvey


On Jul 10, 2007, at 11:17 AM, voltron wrote:


 According to the docs, os.path.join does throw the drive letters away:

 http://docs.python.org/lib/module-os.path.html

 I still think that it would be cool if there was a platform
 independent way in Pylons for doing this. Another thing, it would also
 be nice if one could use several static paths instead of one, just
 like the templates dict.

 Could the Pylons developers  comment on this?


I'm not sure I understand all the details. It sounds like the  
os.path.join of root_path and 'public' (or you renamed to to  
'static') causes an issue on your environment because os.path.join  
removes drive letters and your app is deployed on the D: drive?

os.path.join doesn't appear to mess with drive letters for me:

Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]  
on win32
Type help, copyright, credits or license for more information.
  import os
  os.getcwd()
'C:\\Python24'
  os.path.join(os.getcwd(), 'static')
'C:\\Python24\\static'
 

You said your entire app was located on the D:, if that's the case,  
aren't the other paths working ('templates' for example would be  
utilized by buffet)?

--
Philip Jenvey



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-10 Thread voltron

Actually, the entire app is located on drive D, it is served behind
behind an Apache proxy server located on c:. I was looking for a way
to ensure that I could configure the path of the static content, for
example, images, flash files, javascript files e.t.c. This helps a lot
when I´m developing on windows, and I am more flexible when deploying
the application since I might be have no choice but to deploy on a
windows platform due to a clients wishes.


On Jul 10, 8:42 pm, Philip Jenvey [EMAIL PROTECTED] wrote:
 On Jul 10, 2007, at 11:17 AM, voltron wrote:



  According to the docs, os.path.join does throw the drive letters away:

 http://docs.python.org/lib/module-os.path.html

  I still think that it would be cool if there was a platform
  independent way in Pylons for doing this. Another thing, it would also
  be nice if one could use several static paths instead of one, just
  like the templates dict.

  Could the Pylons developers  comment on this?

 I'm not sure I understand all the details. It sounds like the
 os.path.join of root_path and 'public' (or you renamed to to
 'static') causes an issue on your environment because os.path.join
 removes drive letters and your app is deployed on the D: drive?

 os.path.join doesn't appear to mess with drive letters for me:

 Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]
 on win32
 Type help, copyright, credits or license for more information.
   import os
   os.getcwd()
 'C:\\Python24'
   os.path.join(os.getcwd(), 'static')
 'C:\\Python24\\static'
  

 You said your entire app was located on the D:, if that's the case,
 aren't the other paths working ('templates' for example would be
 utilized by buffet)?

 --
 Philip Jenvey


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-10 Thread Mike Orr

On 7/10/07, Philip Jenvey [EMAIL PROTECTED] wrote:


 On Jul 10, 2007, at 11:17 AM, voltron wrote:

 
  According to the docs, os.path.join does throw the drive letters away:
 
  http://docs.python.org/lib/module-os.path.html
 
  I still think that it would be cool if there was a platform
  independent way in Pylons for doing this. Another thing, it would also
  be nice if one could use several static paths instead of one, just
  like the templates dict.
 
  Could the Pylons developers  comment on this?
 

 I'm not sure I understand all the details. It sounds like the
 os.path.join of root_path and 'public' (or you renamed to to
 'static') causes an issue on your environment because os.path.join
 removes drive letters and your app is deployed on the D: drive?

 os.path.join doesn't appear to mess with drive letters for me:

 Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]
 on win32
 Type help, copyright, credits or license for more information.
   import os
   os.getcwd()
 'C:\\Python24'
   os.path.join(os.getcwd(), 'static')
 'C:\\Python24\\static'
  

The docs are talking about a drive letter in the second argument.  In
that case, the drive in the first argument would be discarded, as it
should be, because os.path.join allows absolute paths on the right to
override paths on the left.

The tricky thing with windows is that C:\\foo is absolute but
C:foo is drive-relative, so join would have to do some extra magic
to ensure the latter case is correct.  But it sounds like the
developers understand the difference.

However, Voltron can replace the entire os.path.join expression with a
different absolute path taken from the config file.

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-10 Thread voltron

Hmm, that means I would not need to exclude the stic file folders in
my Apache configuration. How should I go about this? I have not found
the place where the templates read the folders for static content.

Thanks

On Jul 10, 9:53 pm, Mike Orr [EMAIL PROTECTED] wrote:
 On 7/10/07, Philip Jenvey [EMAIL PROTECTED] wrote:





  On Jul 10, 2007, at 11:17 AM, voltron wrote:

   According to the docs, os.path.join does throw the drive letters away:

  http://docs.python.org/lib/module-os.path.html

   I still think that it would be cool if there was a platform
   independent way in Pylons for doing this. Another thing, it would also
   be nice if one could use several static paths instead of one, just
   like the templates dict.

   Could the Pylons developers  comment on this?

  I'm not sure I understand all the details. It sounds like the
  os.path.join of root_path and 'public' (or you renamed to to
  'static') causes an issue on your environment because os.path.join
  removes drive letters and your app is deployed on the D: drive?

  os.path.join doesn't appear to mess with drive letters for me:

  Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]
  on win32
  Type help, copyright, credits or license for more information.
import os
os.getcwd()
  'C:\\Python24'
os.path.join(os.getcwd(), 'static')
  'C:\\Python24\\static'

 The docs are talking about a drive letter in the second argument.  In
 that case, the drive in the first argument would be discarded, as it
 should be, because os.path.join allows absolute paths on the right to
 override paths on the left.

 The tricky thing with windows is that C:\\foo is absolute but
 C:foo is drive-relative, so join would have to do some extra magic
 to ensure the latter case is correct.  But it sounds like the
 developers understand the difference.

 However, Voltron can replace the entire os.path.join expression with a
 different absolute path taken from the config file.

 --
 Mike Orr [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons SOLVED

2007-07-10 Thread voltron

I read up the Apache docs, the final headache was caused because of  a
missing trailing slash at the end of the proxy declarations

For those in the same situation, here is my config ( only for windows)

VirtualHost *
ServerName localhost
UseCanonicalName Off

DocumentRoot c:/xampp/htdocs
ProxyRequests Off

ProxyPass /css !
ProxyPass /flash !
ProxyPass /img !
ProxyPass /scripts !
ProxyPass /games !
ProxyPass /favicon.ico !

ProxyPass / http://localhost:5000/
ProxyPassReverse / http://localhost:5000/

ErrorLog testsite_error_log
CustomLog testsite_access_log combined

Proxy *
Order deny,allow
Allow from all
/Proxy

Location /balancer-manager
SetHandler balancer-manager

Order Deny,Allow
Deny from all
Allow from all
/Location
/VirtualHost


Thanks once again!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons SOLVED

2007-07-10 Thread Jose Galvez

all those slashes will get you every time.  I'm glad you got it working
jose

voltron wrote:
 I read up the Apache docs, the final headache was caused because of  a
 missing trailing slash at the end of the proxy declarations

 For those in the same situation, here is my config ( only for windows)

 VirtualHost *
   ServerName localhost
   UseCanonicalName Off

   DocumentRoot c:/xampp/htdocs
   ProxyRequests Off

   ProxyPass /css !
   ProxyPass /flash !
   ProxyPass /img !
   ProxyPass /scripts !
   ProxyPass /games !
   ProxyPass /favicon.ico !

   ProxyPass / http://localhost:5000/
   ProxyPassReverse / http://localhost:5000/

   ErrorLog testsite_error_log
 CustomLog testsite_access_log combined

   Proxy *
   Order deny,allow
   Allow from all
   /Proxy

   Location /balancer-manager
   SetHandler balancer-manager

   Order Deny,Allow
   Deny from all
   Allow from all
   /Location
 /VirtualHost


 Thanks once again!


 

   

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Future of serving static content with pylons

2007-07-09 Thread voltron

I have hit the problem again of serving static content from a
directory of my choice. I am serving a Pylons app through an Apache
reverse proxy server, on Linux, this works, I set apache to proxy the
whole root path. On windows, this just does not work.

Would there be a way to set the path of static content to any path(not
just paths under 'public') on a file system that would work properly
on any os in the future?

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-09 Thread Mike Orr

On 7/9/07, voltron [EMAIL PROTECTED] wrote:

 I have hit the problem again of serving static content from a
 directory of my choice. I am serving a Pylons app through an Apache
 reverse proxy server, on Linux, this works, I set apache to proxy the
 whole root path. On windows, this just does not work.

Why doesn't it work on Windows?

 Would there be a way to set the path of static content to any path(not
 just paths under 'public') on a file system that would work properly
 on any os in the future?

I have a symbolic link in my public directory pointing to a large
directory of static files.  Not that this addresses your exact
situation.

Do you have to serve the files through Pylons (e.g., for
authentication or logging)?  What about serving them directly via
Apache (an Alias directive or ProxyPass /pubic !)?

-- 
Mike Orr [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-09 Thread voltron



 Why doesn't it work on Windows?

I´m not sure, exactly why, but even when I do this in my Apache
config:

DocumentRoot /
ProxyRequests Off

ProxyPass /css !
ProxyPass /flash !
ProxyPass /img !
ProxyPass /scripts !
ProxyPass /games !
ProxyPass /favicon.ico !



ProxyPass / http://localhost:5000
ProxyPassReverse / http://localhost:5000

The same configuration, using the real domain name works on my Linux
Server, on windows, my development workstation, it fails, all the
templates render without the static content


 I have a symbolic link in my public directory pointing to a large
 directory of static files.  Not that this addresses your exact
 situation.


I have read of ways to create symbolic links on windows, but in case
of pylons, it feels like a hack, it would be cool just  to modify the
configuration for development on any os, and when its time to deploy
jszt change the setting or use a different ini file for production, as
it was meant to be. Everything else is sort of hackish

 Do you have to serve the files through Pylons (e.g., for
 authentication or logging)?  What about serving them directly via
 Apache (an Alias directive or ProxyPass /pubic !)?


Hmm, I ´ll try using that.


Thanks
 --
 Mike Orr [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-09 Thread voltron

I noticed this in enviroment.py:

root_path =
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

paths = {'root_path': root_path,
 'controllers': os.path.join(root_path, 'controllers'),
 'templates': [os.path.join(root_path, path) for path in \
   ('components', 'templates')],
 'static_files': os.path.join(root_path, 'public')
 }

maybe there should be a user_static key of some sort in the paths
dict. I´m not sure if it would work reliably on windows since
os.path.join removes the drive letters on windows




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-09 Thread Jose Galvez

Hmm I develop with apache on windows.  I've not tried your problem yet,
but I'll take a look at it
Jose

voltron wrote:
 Same result Mike, moving the last two lines above the excludes doe not
 work, static content is not used by the templates. maybe Apache is
 doing a DNS lookup on http://localhost; ?

 Maybe most people dont develop with local Apache servers on windows?

 On Jul 9, 10:42 pm, Mike Orr [EMAIL PROTECTED] wrote:
   
 On 7/9/07, voltron [EMAIL PROTECTED] wrote:



 
 Why doesn't it work on Windows?
 
 I´m not sure, exactly why, but even when I do this in my Apache
 config:
   
 DocumentRoot /
 ProxyRequests Off
   
 ProxyPass /css !
 ProxyPass /flash !
 ProxyPass /img !
 ProxyPass /scripts !
 ProxyPass /games !
 ProxyPass /favicon.ico !
   
 ProxyPass /http://localhost:5000
 ProxyPassReverse /http://localhost:5000
   
 I would expect this to override all your beautiful exclusions above.
 What if you move these two lines above the exclusions?

 --
 Mike Orr [EMAIL PROTECTED]
 


 

   

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Future of serving static content with pylons

2007-07-09 Thread Jose Galvez
Dear Voltron,
I just tested the whole proxypass thing on my windows box and it works
as expected.  Looking at your apache confg code below the only thing I
see is that DocumentRoot is set incorrectly, if that is really how you
have it set that may be the problem.  I believe it needs to be set to
the actual directory  which should be something like

DocumentRoot C:/Program Files/Apache Software Foundation/Apache2.2/htdocs

If that fails, maybe some info would help, what version of apache are
you using?
Jose

voltron wrote:

   
 Why doesn't it work on Windows?
 

 I´m not sure, exactly why, but even when I do this in my Apache
 config:

 DocumentRoot /
   ProxyRequests Off

   ProxyPass /css !
   ProxyPass /flash !
   ProxyPass /img !
   ProxyPass /scripts !
   ProxyPass /games !
   ProxyPass /favicon.ico !



   ProxyPass / http://localhost:5000
   ProxyPassReverse / http://localhost:5000

 The same configuration, using the real domain name works on my Linux
 Server, on windows, my development workstation, it fails, all the
 templates render without the static content

   
 I have a symbolic link in my public directory pointing to a large
 directory of static files.  Not that this addresses your exact
 situation.

 

 I have read of ways to create symbolic links on windows, but in case
 of pylons, it feels like a hack, it would be cool just  to modify the
 configuration for development on any os, and when its time to deploy
 jszt change the setting or use a different ini file for production, as
 it was meant to be. Everything else is sort of hackish

   
 Do you have to serve the files through Pylons (e.g., for
 authentication or logging)?  What about serving them directly via
 Apache (an Alias directive or ProxyPass /pubic !)?

 

 Hmm, I ´ll try using that.


 Thanks
   
 --
 Mike Orr [EMAIL PROTECTED]
 


 

   

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Serving static content

2007-05-01 Thread Cliff Wells

On Mon, 2007-04-30 at 10:34 -0700, voltron wrote:
 Thanks for your answers Cliff. I took a look at Nginx, it looks very
 interesting, would you care to post an example of your Nginx config
 file?

Here's a pretty basic setup that proxies to a Pylons backend and serves
static content from a particular directory:

# server section from nginx.conf
server { 
listen123.123.123.123:80;
server_name   www.example.com example.com;
access_log/var/log/nginx/example.com-access.log main;

location / {
proxy_pass  http://127.0.0.1:8080; # proxy to pylons app
include /etc/nginx/proxy.conf; # see below
}

# static content
location ~ ^/(images|javascript|css|flash|yui|yui-ext|downloads)/  {
root/var/www/public_html;
expires 30d;
}
location = /favicon.ico  {
root/var/www/public_html/images;
}
}


# proxy.conf - common to lots of vhosts
proxy_set_headerHost $host;
proxy_set_headerX-Real-IP $remote_addr;
proxy_set_headerX-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size10m;
client_body_buffer_size 128k;
proxy_connect_timeout   90;
proxy_send_timeout  90;
proxy_read_timeout  90;
proxy_buffer_size   4k;
proxy_buffers   4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;


There's other examples on the Nginx wiki.

Regards,
Cliff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Serving static content

2007-04-30 Thread Cliff Wells

On Mon, 2007-04-30 at 01:09 -0700, voltron wrote:
 Can one map the /public folder in a Pylons web application to a folder
 declared for use by a separate web-server?

This is a question about your webserver, not Pylons.  Simply tell your
webserver to serve content from that directory (or any other directory)
and refer to the correct location in your templates.  

Personally I prefer not having static files in the same directory tree
as my application.

 Once in a while, the graphic artists would like to change CSS or image
 files, the have access to the server root and can upload data in /css
 and /image folders respectively. For production, one would use a Web
 server like Apache or Cherokee, and since they are the best at what
 they do, serving static content fast, it would make sense that all
 static cont be served from them.

I have a mild suspicion this is what everyone does.

 Is there some preferred basic general setup that can be used?

I usually proxy to my Pylons app from Nginx, and tell Nginx to serve
static files from a specific directory.  In your case, you'd use Apache
or Cherokee, so you'll have to read the documentation for those
webservers.

Regards,
Cliff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: Serving static content

2007-04-30 Thread voltron

Thanks for your answers Cliff. I took a look at Nginx, it looks very
interesting, would you care to post an example of your Nginx config
file?

Thanks

On Apr 30, 4:18 pm, Cliff Wells [EMAIL PROTECTED] wrote:
 On Mon, 2007-04-30 at 01:09 -0700, voltron wrote:
  Can one map the /public folder in a Pylons web application to a folder
  declared for use by a separate web-server?

 This is a question about your webserver, not Pylons.  Simply tell your
 webserver to serve content from that directory (or any other directory)
 and refer to the correct location in your templates.

 Personally I prefer not having static files in the same directory tree
 as my application.

  Once in a while, the graphic artists would like to change CSS or image
  files, the have access to the server root and can upload data in /css
  and /image folders respectively. For production, one would use a Web
  server like Apache or Cherokee, and since they are the best at what
  they do, serving static content fast, it would make sense that all
  static cont be served from them.

 I have a mild suspicion this is what everyone does.

  Is there some preferred basic general setup that can be used?

 I usually proxy to my Pylons app from Nginx, and tell Nginx to serve
 static files from a specific directory.  In your case, you'd use Apache
 or Cherokee, so you'll have to read the documentation for those
 webservers.

 Regards,
 Cliff


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
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
-~--~~~~--~~--~--~---