background preloader

Pylons

Facebook Twitter

Chris moos’s blog » Blog Archive » CouchDB and Pylons: User Registration and Login. In the previous tutorial, we learned how to get CouchDB and Pylons up and running, as well as create a simple page counter. Now we are going to implement a simple user authentication system. This tutorial will teach you how to use formencode to validate forms and CouchDB to store our user data. Let's start by creating a new pylons project and some controllers. $ paster create -t pylons userdemo $ cd userdemo $ paster controller main $ paster controller auth Also, delete public/index.html. For our controller main, we are going to add one action called index. This will be the main page for the site and will only be accessible for logged in users. For checking to see if a user is logged in, we will store a user_id in the session. If you start the server now and go to you will be redirected to /auth/login. Open up and create a new database, and call it userdemo.

Now we are going to define our User schema in model/init.py. Templates/login.mak: CouchDB and Pylons: User Registration and Login : CouchDB. Chris moos’s blog » Blog Archive » CouchDB and Pylons: Getting Started. CouchDB is very cool(it's built on erlang), and with Pylons, it is even cooler. Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API. Normally a Pylons web application will use some sort of RDBMS for storing data and persistence -- such as MySQL or PostgreSQL. I've decided to go a different route and integrate Pylons with CouchDB. Right now there is a Python library, couchdb-python, that will help us communicate with our CouchDB's HTTP/JSON api.

For this article, I will assume you have Pylons installed and you are somewhat familiar with it. We are going to create a simple page counter application. CouchDB is written in Erlang, a functional programming language with high concurrency. . $ wget $ tar -xvzf otp_src_R12B-5.tar.gz $ cd otp_src_R12B-5 $ . You should now have erlang installed. Now let's install CouchDB. Okay. Alright, we are almost there. Easy_install: Alternative Pylons Reference Documentation :: The Pylons Modern Apocrypha.

Shabti — Shabti v0.3 documentation.