pylons

What is the best way to deploy a Pylons app?

There are many ways to deploy Pylons apps. - Proxying through apache or nginx to paste - Embedding the app with mod_wsgi - using some edgy nginx+uwsgi combo - and probably more... I've read a lot about the various approaches but failed to really decide which one to choose. Proxying to paste through nginx seems to be the easiest method...

How to redirect to a url with non-English characters?

I'm using pylons, and some of my urls contains non-English characters, such as: http://localhost:5000/article/111/文章标题 At most cases, it won't be a problem, but in my login module, after a user has logging out, I try to get the referer from the request.headers, and redirect to that url. if user_logout: referer = request.headers.g...

How can I strip whitespace and newlines with Mako templates? My 12362 line HTML file is killing IE

I'm using the Mako template system in my Pylons website and am having some issues with stripping whitespace. My reasoning for stripping whitespace is the generated HTML file comes out as 12363 lines of code. This, I assume, is why Internet Explorer is hanging when it tries to load it. I want to be able to have my HTML file look nice an...

How to config cookie-only sessions in pylons?

I want to use cookie-only sessions in pylons. I have found some documents for this problem, but unfortunately, they said a lot, but where and how to config it. http://pylonshq.com/docs/en/0.9.7/sessions/ http://wiki.pylonshq.com/display/beaker/Cookie-Only+Sessions I'm new to pylons, and I don't know how to config. Somebody can help me...

How to get the root path of a pylons website

I'm using pylons to build websites. I want to write some files to a directory under the root of the project, but I don't konw how can I get the root path(project path) in the controller? ...

pkg_resources.VersionConflict when I try to start paster serve

Im trying to use port 80. So when i use the command "sudo paster serve development.ini --reload" I get this error pkg_resources.VersionConflict: (Pylons 0.9.7 (/usr/lib/pymodules/python2.6), Requirement.parse('Pylons>=1.0')) I tried to do "easy_install pylons" but I get "Pylons 1.0 is already the active version in easy-install.pth...

How to set all cookies with a single max_age in pylons?

Normally, we set the cookie with a single max_age as following: response.set_cookie('name1', 'value1', max_age=3600*24*365) response.set_cookie('name2', 'value2', max_age=3600*24*365) response.set_cookie('name3', 'value3', max_age=3600*24*365) Note, we set the max_age again and again. How to set a default max_age to all cookies that d...

Which webserver I should use for a pylons website?

I'm building a website with pylons. When I develop it, I use paster serve to start the built-in web server. But now, I want to publish it to a standalone server, which web server I should use? I hope it robust and has hign performance. ...

How do I start the pylons web application programmaticly?

Normally, we start a pylons web application via command line: pastser serve --reload development.ini I wanna know can we start it programmaticly? In a python script file? I want this because I can start it in IDE, and use the debugger ...

nosetests --with-pylons test.ini => Error: no such option: --with-pylons

I followed the application to run the tests of pylons project: http://pylonshq.com/docs/en/0.9.7/i18n/#testing-the-application But when I run: nosetests --with-pylons test.ini It reports an error: E:\pylons\helloworld>nosetests --with-pylons test.ini Usage: nosetests-script.py [options] nosetests-script.py: error: no such option:...

Python routes - I'm trying to set the format extension but it's failing

I'm trying to setup my Routes and enable an optional 'format' extension to specify whether the page should load as a standard HTML page or within a lightbox. Following this http://routes.groovie.org/setting_up.html#format-extensions, I've come up with: map.connect('/info/test{.format:lightbox}', controller='front', action='test') clas...

How to connect to Cassandra inside a Pylons app ?

Hey. I created a new Pylons project, and would like to use Cassandra as my database server. I plan on using Pycassa to be able to use cassandra 0.7beta. Unfortunately, I don't know where to instantiate the connection to make it available in my application. The goal would be to : Create a pool when the application is launched Get a c...

How can textmate make my python (pylons) development easier?

I have textmate, but honestly the only thing I can do with it is simply edit a file. The handy little file browser is aslo useful. (how can I show/hide that file browser anyhow!) But I have no other knowledge/tricks up my sleeve, care to help me out? ...

Creating a new virutalenv hangs

I have a macbookpro. I downloaded virtualenv.py from pylonsbook.com/virutalenv.py when I type: python virtualenv.py --no-site-packages env it outputs: New python executable in env/bin/python then it just hangs, I don't get the prompt in terminal. I've restarted the computer and I get the same result, what's wrong? ...

Tying to change the Pylons version my website is using but this causes a DistributionNotFound exception

About a month ago I setup Pylons on my VPS in a virtual environment using the go-pylons.py script they provide. I've, since then, been working on my website and have it all up and running. It works great. Recently though I discovered that I created my virtual python environment using Python2.5. I now want to change this to Python2.7 I'...

How can I integrate Arecibo error reporting with Pylons?

I've written a very rudimentary attempt to integrate Arecibo reporting with Pylons, but the sad fact of the matter is that it basically doesn't work. I've conceived of this as middleware, but I'm not sure A) where to put it in the middleware stack without interfering with other aspects of the middleware, B) how to get at various bits of...

How to let actions support more parameters?

I'm using pylons, and my action of controller is: class UserController(BaseController): def create(self): name = request.POST['name'] email = request.POST['email'] password = request.POST['password'] ... But I found in turbogears, I can do like this: class UserController: de...

Passing state when using decorators (formencode) in pylons

I've met the same problem as this page: http://www.mail-archive.com/[email protected]/msg14292.html This is the main content from there: I am using formencode to validate my forms, and I've stumbled upon a problem. When using tha validator inside the controller action, I call to_python() and I can pass the sta...

Will nginx+paste hold up in a production environment?

I've developed a website in Pylons (Python web framework) and have it running, on my production server, under Apache + mod_wsgi. I've been hearing a lot of good things about nginx recently and wanted to give it a try. Currently, it's running as a forwarding proxy to create a front end to Paste. It seems to be running pretty damn fast.....

How to know the 'controller' and 'action' from the request url in Pylons?

I want to log the controller and action when a request comes, so I write a __before__ in the base controller: class BaseController: __before__(self): controller = get_controller(request) action = get_action(request) logger.log('%s - %s'%(controller, action)) But I don't know how to get the controlle...