Re: turbogears2/pylons and public/static folder
On Sat, Nov 15, 2008 at 2:28 PM, Alberto Valverde [EMAIL PROTECTED] wrote: Lukasz Szybalski wrote: (...) When this happens a SCRIPT_NAME variable is passed to pylons app(this is a wsgi standard as I'm being told from wsgi list), in the example above the script name I believe is /myapp/. What this does is tells pylons app that everything needs to be prefixed with myapp example.com/myapp/index or example.com/myapp/adduser. The problem with this is that all url inside the project are prefixed but the static files images and css are not prefixed. So while my app knows the url is example.com/myapp/index the static files have no idea about the prefix and are pointing to example.com/images instead of pointing to example.com/myapp/images (...) Are you wrapping the urls of your staic files with url_for()?, eg: script ... src=${h.url_for('/js/my.js')}/script Without this there's no way the urls in the template can be prefixed with SCRIPT_NAME... h.url_for it is.. Thanks, Lucas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-devel group. To post to this group, send email to pylons-devel@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-devel?hl=en -~--~~~~--~~--~--~---
Re: turbogears2/pylons and public/static folder
Lukasz Szybalski wrote: (...) When this happens a SCRIPT_NAME variable is passed to pylons app(this is a wsgi standard as I'm being told from wsgi list), in the example above the script name I believe is /myapp/. What this does is tells pylons app that everything needs to be prefixed with myapp example.com/myapp/index or example.com/myapp/adduser. The problem with this is that all url inside the project are prefixed but the static files images and css are not prefixed. So while my app knows the url is example.com/myapp/index the static files have no idea about the prefix and are pointing to example.com/images instead of pointing to example.com/myapp/images (...) Are you wrapping the urls of your staic files with url_for()?, eg: script ... src=${h.url_for('/js/my.js')}/script Without this there's no way the urls in the template can be prefixed with SCRIPT_NAME... Alberto --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-devel group. To post to this group, send email to pylons-devel@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-devel?hl=en -~--~~~~--~~--~--~---
Re: turbogears2/pylons and public/static folder
Hey Lucas, I believe this just works. Can you do a bit of research before asking questions. We need to know what you've tried, what errors you're getting, and how you've tried to fix them on your own before we'll be able to help you easily. You might want to read this very good essay on how to ask questions: http://www.catb.org/~esr/faqs/smart-questions.html I can promise you that better questions will get you better answers. ;) --Mark Ramm On Fri, Nov 14, 2008 at 9:44 AM, Lukasz Szybalski [EMAIL PROTECTED] wrote: Can pylons add a patch to make sure below works. Thanks, Lucas Do you know how can I set server.webpath in wsgi scipt? You should not need to set server.webpath. A well behaved WSGI application would automatically derive the application mount point from the value of SCRIPT_NAME passed by the underly WSGI adapter to the WSGI application. If TG2/Pylons doesn't do this, then it is broken. Thus, you should just need to say: WSGIScriptAlias /subapp /some/path/subapp.wsgi Alias /subapp/images /some/otherpath/subapp/static/images Alias /subapp/css /some/otherpath/subapp/static/css WSGIScriptAlias / /some/path/rootapp.wsgi Alias /images /some/otherpath/rootapp/static/images Alias /css /some/otherpath/rootapp/static/css and it should work. If not, then as I said, TG2/Pylons is arguably doing the wrong thing, or way that URLs within pages for images and css are being constructed wrongly. See old discussion. http://groups.google.com/group/turbogears/browse_frm/thread/b8978e071762428d I believe that maintenance happening on older TG1 derived versions may have added a patch for this to subversion. Whether it has been released in a TG1 version I am not sure. Graham -- Mark Ramm-Christensen email: mark at compoundthinking dot com blog: www.compoundthinking.com/blog --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-devel group. To post to this group, send email to pylons-devel@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-devel?hl=en -~--~~~~--~~--~--~---
Re: turbogears2/pylons and public/static folder
sorry...here you go... This is a continuation of this thread: http://groups.google.com/group/pylons-devel/browse_thread/thread/25212f5a0e953a31 The basic problem is that when you deploy pylons app under mod_Wsgi I deploy apps not as root mounted app but under some name. (root mounted) example.com/ vs (not root mounted) example.com/myapp/ The way you mount the non root app in apache configuration is this: 1. (you create an alias to the wsgi script in your apache settings) 2. the wsgi script that I'm aliasing has all the information it need to load pylons app (example) WSGIScriptAlias /myapp /some/path/myapp.wsgi Above should run my app example.com/myapp/ WSGIScriptAlias /myapp3 /some/path/myapp.wsgi Would run my app example.com/myapp3/ When this happens a SCRIPT_NAME variable is passed to pylons app(this is a wsgi standard as I'm being told from wsgi list), in the example above the script name I believe is /myapp/. What this does is tells pylons app that everything needs to be prefixed with myapp example.com/myapp/index or example.com/myapp/adduser. The problem with this is that all url inside the project are prefixed but the static files images and css are not prefixed. So while my app knows the url is example.com/myapp/index the static files have no idea about the prefix and are pointing to example.com/images instead of pointing to example.com/myapp/images Due to wsgi specifications(http://wsgi.org/wsgi/Specifications/routing_args) I should be able to change the name of the prefix(SCRIPT_NAME) anyway I want and all (pylons app and static content should be able to figure out the new url). The only thing I should need to change is Alias variable. WSGIScriptAlias /myapp3 /some/path/myapp.wsgi would display example.com/myapp3/images WSGIScriptAlias /myapp4 /some/path/myapp.wsgi would display example.com/myapp4/images I hope this clears things up. It seems to me that script_name is already implemented withing pylons but its not implemented for static content. Thanks, Lucas On Fri, Nov 14, 2008 at 9:49 AM, Mark Ramm [EMAIL PROTECTED] wrote: Hey Lucas, I believe this just works. Can you do a bit of research before asking questions. We need to know what you've tried, what errors you're getting, and how you've tried to fix them on your own before we'll be able to help you easily. You might want to read this very good essay on how to ask questions: http://www.catb.org/~esr/faqs/smart-questions.html I can promise you that better questions will get you better answers. ;) --Mark Ramm On Fri, Nov 14, 2008 at 9:44 AM, Lukasz Szybalski [EMAIL PROTECTED] wrote: Can pylons add a patch to make sure below works. Thanks, Lucas Do you know how can I set server.webpath in wsgi scipt? You should not need to set server.webpath. A well behaved WSGI application would automatically derive the application mount point from the value of SCRIPT_NAME passed by the underly WSGI adapter to the WSGI application. If TG2/Pylons doesn't do this, then it is broken. Thus, you should just need to say: WSGIScriptAlias /subapp /some/path/subapp.wsgi Alias /subapp/images /some/otherpath/subapp/static/images Alias /subapp/css /some/otherpath/subapp/static/css WSGIScriptAlias / /some/path/rootapp.wsgi Alias /images /some/otherpath/rootapp/static/images Alias /css /some/otherpath/rootapp/static/css and it should work. If not, then as I said, TG2/Pylons is arguably doing the wrong thing, or way that URLs within pages for images and css are being constructed wrongly. See old discussion. http://groups.google.com/group/turbogears/browse_frm/thread/b8978e071762428d I believe that maintenance happening on older TG1 derived versions may have added a patch for this to subversion. Whether it has been released in a TG1 version I am not sure. Graham -- Mark Ramm-Christensen email: mark at compoundthinking dot com blog: www.compoundthinking.com/blog -- Turbogears2 Manual http://lucasmanual.com/mywiki/TurboGears2 Bazaar and Launchpad http://lucasmanual.com/mywiki/bzr --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups pylons-devel group. To post to this group, send email to pylons-devel@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-devel?hl=en -~--~~~~--~~--~--~---