Be considerate to the documentation

38 views
Skip to first unread message

john

unread,
Feb 2, 2011, 3:11:16 PM2/2/11
to Pecan Developers List
Is that at the moment Pecan has no documentation yet, would be helpful
include the following documentation:
- Implementing Pecan use Nginx
- Lock pages if not authenticated
- Pecan and Celery

Best regards,
John

Yoann Roman

unread,
Feb 4, 2011, 11:55:37 AM2/4/11
to Pecan Developers List
Hi John,

We absolutely agree that the Pecan docs need some attention. That's at
the top of the list for the sprint we have coming up in early March.
In the meantime, here are some pointers:

Implementing Pecan using Nginx
Pecan is a standard WSGI framework, so you would run it behind Nginx
just like any other WSGI framework (e.g., Pylons, TurboGears). Your
options are basically to run it directly within Nginx using its WSGI
module (http://wiki.nginx.org/NgxWSGIModule) or have Nginx proxy to
one or more Python WSGI servers running Pecan (e.g., Paste, CherryPy).

Lock pages if not authenticated
You would use pecan.secure.SecureController for that. For example:

from pecan.secure import SecureController, unlocked
from yourapp.some.lib import get_current_user

class AccountSettingsController(SecureController):

@classmethod
def check_permissions(cls):
if get_current_user() is None:
return False
return True

@expose('index.mak')
def index(self):
# only logged in users can access this
return dict()

@unlocked
@expose('login.mak')
def login(self):
# all users can access this
return dict()

Pecan and Celery
Check out the pecancelery project on GitHub for information on how to
do this: https://github.com/ryanpetrello/pecancelery.

Hope that helps!
Reply all
Reply to author
Forward
0 new messages