Sunday, February 28, 2010

A Beginner's First Look at Pinax

Before my laborious morning commute to Manhattan the other day, I decided that I would download a copious amount of .pdfs, documentation, and other files in order to learn about python and maybe try out some new python technology. This is where Pinax comes in.

Pinax is a technology based on Django, which in turn is a technology based on Python. Of course Python is a dynamic programming language that is easy to use and especially easy to read. Django is similar to Ruby on Rails, in the fact that it is used to make an easy to use MVC architecture to your web applications. On top of this architecture is Pinax, which takes all of the projects you might find yourself writing over and over again, and throws it into a single command that your run and like magic you're up and running. One of the neatest of these prebuilt projects is the social website project, which basically builds something similar to facebook in a matter of seconds. It's so easy to use it's mind blowing.


But what if I want to customize it?

This is where I had some trouble. And hopefully, this post will help you avoid some of the things that aren't so obvious to a newbie.

I first created a basic project following the documentation provided on pinaxproject.com. But where do I go from here? There are docs on how to customize tabs, but that's it.

The first thing I wanted to do obviously is change the styles. I did some poking around on the internets and some readme file, to find out that you need to create a folder in

pinaxenvironment_path/lib/python2.6/site-packages/pinax/templates/

In this new folder you make whatever changes to templates you want, then whene you're done you have to change your 'pinax_theme' setting in your settings.py to the foldername that you created. By default it is 'default'.

Doing this wasn't really the first thing I thought of, as a newbie.

Next, I wanted to add some of my own application to my default pinax project. I did what I would normally do in Django, create the new app inside the project folder, write my models, views, templates, etc, add to my settings under installed apps. Everything was going great except that my new application couldn't see any of the media from my pinax app, nor could it remember whether or not I was logged in! Thankfully, the people at #pinax on FreeNode were very helpful, and James Tauber answered my issue, which was that I needed to use RequestContext for my views.

All In all, I've only had those two problems so far with Pinax. I sometimes wish there were more documentation on their site. I still have questions.

How can I add and remove specific apps from pinax? What if I wanted just the blog application? I've tried to add and remove applications, but some are dependent on one another and at the time of me downloading the docs, there were no and may still not be any good documentation on how to do this.

I think something like a tutorial of an example site that can be made using pinax would be great. The preset sites are awesome, and they are very useful, but I think that a tutorial outlining how to make tweaks to your piinax site, subtracting certain features or adding features from your own django creations or from other pinax projects would be very useful. I have a very vague idea of what it's like to develop 'in' pinax, and I'd like to see a more concrete example to make sure that I'm going about it in the right manner.

All in all, Pinax is a really exciting technology and I will definitely be using it extensively for any future clients. It's powerful, and the default projects felt really stable, and although changing the theme wasn't initially apparent to me, it was easy to do that, too.

If you're a newbie to python web development and you're curious about these new technologies, then I hope this helped you out.

Also, if you're interested in what pinax can do, check out their website! Or check out cloud27, a project made with Pinax which is really neat!

Happy hacking!

-Sean

No comments: