Create a new social networking site in few hours using pinax platform (django).

by Rama Vadakattu on March 18, 2009

if you are excited to see how such a social networking site would like.Just follow the below link

http://www.xfgx.info/

We made the above site on pinax platform (Please note pinax has done most of things we have done very little).A platform for rapidly developing websites.

In this blogpost we will try to understand what pinax is? How it helps a developer to do things quickly? How to install & deploy? and various other things related to pinax.

What is Pinax?

In the present day world every website require components like regisration,openid support,some kind groups/ tribes,user profiles etc…..Almost every site has to code logic for these components. As they are reusable across many sites what if we have a platform (means a django project) which provides all these reusable components outof box and asks the developer to built on top of it.Such a platform help the developers to rapidly build the websites , it helps them to focus on core aspects of their site.

Pinax is such a (django) platform which provides a collection of integrated reusable django apps.Out of box pinax provides several reusable components/apps like

  1. openid support

  2. contact import (from vCard, Google or Yahoo)

  3. notification framework etc…

More details at http://pinaxproject.com/

If you still haven’t understood please look at the talks given by James Tauber (creator of piinax) at

  1. http://thisweekindjango.com/twid/episode/24/this-week-in-django-24/

Let us dig into more details like how to install and deploy pinax,

How to install pinax?

 Get the latest version of pinax
 1.svn checkout http://svn.pinaxproject.com/pinax/trunk/   pinax
 2.cp pinax/projects/complete_project    ../../complete_project
 3.mv compete_project myprojectname
  1. First check out the latest version of pinax.
  2. Then get into the pinax/projects directory where you will find several projects like complete_project , basic_project.
  • Complete_project : provides all reusable apps listed on pinaxproject website.You need to build on top of this project if the application which you are going to develop requires all or many of these.

  • basic_project : it provides only very basic reusable apps like registration,login,openid support etc.You need to build on top of this project if you just requires only registrationa and login support.

etc….

3.Take out the project on which you want to built (it can be complete project or basic project or others depending on your needs) to the another directory where your django projects are there.

Note : After step 3 if you are installing stable version pinax0.5.1 instead of latest version at trunk , then you should follow the installation instructions given at the bottom of this blog.


4.sudo easy_install pip
5.sudo easy_install virtualenv
6.sudo apt-get install git-core
7.sudo apt-get install bzr
8.sudo pip install -r pinax/requirements/external_apps.txt

In previous versions pinax is using svn:externals to bring third party apps which merge into the pinax source code.But now pinax team has moved from svn:externals to pip.

More details : http://code.google.com/p/django-hotclub/wiki/MovingToDistutils

What is pip?

pip is similar to easy_install.easy_install allows you to install several python pakages.Similarly pip allows you to install third party apps and also python packages.

4.First install pip,virtualevn (isolated Python environments)

Please refer this url http://blog.ianbicking.org/2008/12/14/a-few-corrections-to-on-packaging/ for more info on pip and virtualenv

5,6,7.You also need to install git and bzr repositories.

Please refer this url for more info http://iraniweb.com/blog/?cat=17

8.using pip install all the third party external apps which are listed in pinax/requirements/external_apps.txt file.

10 cd myprojectname (which you created in step 3)
11.change PINAX_ROOT & ROOT_URLCONF in setting.py
12 python manage.py syncdb
13.python manage.py runserver

11.change myprojectname.settings.py as follows

  1. PINAX_ROOT = “path to pinax directory which was created in step 1″.
  2. For ROOT_URLCONF please change it from complete_project.urls to urls.

Now type http://localhost:8000/ you will see pinax project screens, lots of common functionality is being provided out of box by pinax platform.

How to remove an application from pinax?

Apps are independent of one another.It is the project which integrates all this django reusable applications.You can remove an app by first removing the respective app urls in urls.py and changing several templates to reflect this.

How to add another application to pinax?

Just put it on the python path and add in settings.INSTALLED_APPS tuple.

More details about installation,deployment at http://pinaxproject.com/docs/0.5.1/deployment.html

How to deploy?

Deploying a pinax application is also very easy if you are using mod_python just add the following to your httpd.conf file

<Location "/">;
SetHandler python-program
PythonHandler myprojectname.deploy.modpython
SetEnv DJANGO_SETTINGS_MODULE complete_project.settings
PythonDebug On
PythonPath "['path to directory which contains your project (created in step3)','path to pinax project which     you   
made in step 3"] + sys.path"
<Location>
  • Note that PthyonHandler is myprojectname.deploy.modpython instead of django.core.handlers.modpython

  • Please note that portions of media is being served from myprojectname (created in step 3) and from the pinax directory(Created in step 1, myprojectname has reference to that).Please take a note of this while creating symlinks for the media.

Have you every used pinax? if yes then please let us know your experience on pinax in comments.And also point me out if there are any corrections or mistakes in the above article.

Update (Installation of pinax 0.5.1 stable version)

After 3rd step you should do the following

4.cd myprojectname 
5.change PINAX_ROOT in manage.py 
PINAX_ROOT =  '“path to pinax directory which was created in step 1'   
6.change ROOT_URLCONF in settings.py     
 ROOT_URLCONF = 'For ROOTURLCONF please change it from completeproject.urls to urls'.
7. continue from  step 12  of above installation (whch is for trunk).

As this stable version is using svn:externals there is no need to install third party applications via pip.

Related posts:

  1. Create your own online store in few hours using satchmo (django)
  2. Django-subdomains – Easily create subscription based subdomains enabled webapps

2 Comments 2 Tweets

{ 1 trackback }

andy.edmonds.be › links for 2009-03-20
March 20, 2009 at 7:33 pm

{ 41 comments… read them below or add one }

1 Phillip March 18, 2009 at 9:50 am

http://www.xfgx.info/ is broken with page displaying:

TemplateSyntaxError at /

Caught an exception while rendering: Reverse for ‘pinaxsnetwork.home’ with arguments ‘()’ and keyword arguments ‘{}’ not found.

You shouldn’t have DEBUG=True on a live site, btw.

Phillip.

2 John Shimek March 18, 2009 at 11:29 am

Since you installed virtualenv, shouldn’t you do the pip install inside of a virtualenv? Otherwise, thanks for the short howto.

3 Rama Vadakattu March 18, 2009 at 10:58 pm

@Phillip 1.Thanks for pointing that.Will rectify the error very soon.

2.http://www.xfgx.info/ is just a demo site to showcase the power of pinax platform.

4 Brian March 20, 2009 at 11:56 am

“2.http://www.xfgx.info/ is just a demo site to showcase the power of pinax platform.”

Well, it’s really good at being down then.

5 Stuart March 20, 2009 at 6:27 pm

Template syntax error the first time I tried to use it, worked a few seconds later. Given people were complaining about error two days ago this is not something I would feel comfortable spending time on. Bummer.

6 Rama Vadakattu March 20, 2009 at 10:04 pm

Sorry if it does so. @Stuart , @Brian I have thoroughly checked after receiving complaint from @phillip. But i could not able to see any template syntax error.As far as i know there is only one problem with Geo locations.

From http://www.xfgx.info/ profiles i can see that yesterday itself around 100 people have registered and has tested the site.

Any way i will throughly check it once again and mail you to try it out. Iam sure that you will appreciate the power of pinax platform after seeing the site.

Once again sorry for inconvenience we will try our level best to resolve the above problem (if any).

7 Rama Vadakattu March 20, 2009 at 10:59 pm

I have thoroughly tested the site i could not able to see any problems. Incase if you encounter any errors/problems with the application please let us know. We will quickly resolve those errors.

8 Fitzgerald Steele March 26, 2009 at 9:51 pm

I used an earlier version of pinax to setup a website/intranet for my research lab. I wrote a blog post about customizing and deploying pinax.

You recommended deploying with mod_python, however when I was setting up my site the pinax maintainers strongly suggested I use mod_wsgi. I was able to get deployed with mod_wsgi, where I struggled with mod_python. Has pinax changed their recommend deployment strategy?

9 Daniel Greenfeld March 27, 2009 at 9:25 am

Might I suggest you change this tutorial to not go against TRUNK? Trunk is not a formal release. This means that it will not be stable. It will not work for everyone. And what works today might fail tomorrow. And it certainly won’t work well with Windows.

Please have people download a formal, official release such as 0.5.1. Then base your documentation off of that. You will be able to support Windows users too.

10 Rama Vadakattu March 28, 2009 at 12:23 am

@Fitzgerald Steele When i referred the documentation of pinax i felt mod_python approach is easy and used it here.

@Daniel Greenfeld Yes it is true.Actually to get to know about latest features i have used trunk. I also feel that it is good idea to write a tutorial based on stable version instead of trunk. Considering your suggestion next time onwards we will write tutorials and how to’s on stable version instead of trunk ( if there are any problems with stable version then we may write on trunk) .

11 naipunya March 28, 2009 at 12:52 am

hi

12 Daniel Greenfeld March 30, 2009 at 3:01 pm

@RAMA,

Is it possible for you to change this tutorial to go against 0.5.1 until we pin the 0.7 release?

13 dhiraj March 31, 2009 at 2:18 pm

hi,

I am getting a Error: No module named notification, while doing “python manage.py syncdb”

14 Rama Vadakattu March 31, 2009 at 10:40 pm

@ dhiraj, Have you installed third party external apps using pip ?. (i.e) step 8 in the above tutorial.

15 Rama Vadakattu April 1, 2009 at 6:18 am

@Daniel Greenfeld i have updated the blog post which now includes installation instructions of pinax stable version 0.5.1.

16 cancel bubble April 2, 2009 at 2:56 pm

Why must I “Sign up and Log in to try out the site”?

17 dhiraj April 3, 2009 at 2:51 am

Hi, Now i have followed pinax stable version instructions and getting a Error: No module named django_openidauth, while doing “python manage.py syncdb”

18 Rama Vadakattu April 6, 2009 at 12:49 am

@cancel bubble We included Signup / login for the following reasons : 1.So that you get the chance to check out login and registration pages of pinax . (As this site is exclusively for demo purposes) .
And also while signing up just provide a dummy username and password (email is optional).

@dhiraj, I have used similar installation steps as listed in the tutorial (for stable and trunk) and i successfully installed. Anyway just try to install “django-openidauth” and run syncdb again.and let me know.

19 David April 8, 2009 at 2:15 am

Hello Rama,

I’ve successfully installed and ran the ‘Basic project’ of Pinax. No problemo.

With the ‘Complete project’, a couple of warnings came up: the md5, sets, sha, module deprecated and 4 different sytax warnings… After runserver command, and opening up localhost, I got a TemplateSytaxErrror Exception Value: Caught an exception while rendering: Could not import friends_app.views. Error was: No module named gdata.contacts.service Exception Location: \site-packages\django\template\debug.py in render_node, line 81

Could it be that I’m using the a non-supported version of Python (2.6.1)..?

NOTE: Pinax version: 0.5.1 Python version: 2.6.1 Windows XP.

Thanks in advance!

20 Matt April 16, 2009 at 1:48 pm

It seems that the google import contacts code is broken. I tried it with a local server, and with the sample http://www.xfgx.info/ and got the exact same error NonAuthSubToken. Anyone have this error?

21 Helpflasp April 16, 2009 at 6:24 pm

nice, really nice!

22 Mike May 15, 2009 at 3:01 pm

I don’t really know about this. Anyone using this might find themselves asking themselves: Did you catch the train? It’s a little late in the game.

23 site ekle June 9, 2009 at 3:42 am

Thank you for article. I took great pleasure to read

24 Myles June 14, 2009 at 1:49 pm

Hi, I’m thinking about starting a social networking site for writers, and I was wondering 2 things: 1) is there a way to make groups secure, as in by invite only 2) is there an easy app for uploading files (particularly word files) in both the group and user-to-user setting

Myles

25 beylikdüzü halı yıkama July 3, 2009 at 8:33 am

really thanks.I was looking for this kind of infos on the net.finally after my some search I found here.this article is the right place I search mostly

26 ap3x July 14, 2009 at 11:16 am

I get a 500 server error when I set: PythonHandler complete_project.deploy.modpython so I corect this to: PythonHandler /home/user/site/pinax/projects/complete_project/deploy/modpython.py and everything is ok

27 Sohbet July 21, 2009 at 11:57 pm

Have you installed third party external apps using pip ?. (i.e) step 8 in the above tutorial.

28 Amit Green August 22, 2009 at 11:34 pm

Error in using http://www.xfgx.info/

TemplateSyntaxError at /

Caught an exception while rendering: Tried login in module authsub.views. Error was: ‘module’ object has no attribute ‘login’

29 Ronald August 27, 2009 at 4:18 pm

TemplateSyntaxError at /

Caught an exception while rendering: Tried login in module authsub.views. Error was: ‘module’ object has no attribute ‘login’

30 Jack August 29, 2009 at 8:45 pm

I got a error after i installed the complete_project the error is : Caught an exception while rendering: Tried login in module authsub.views. Error was: ‘module’ object has no attribute ‘login’

just the same error as @Amit Green and Ronald

and i find no way ti fix the bug.

31 Joe August 31, 2009 at 1:49 pm

I have tried several times over the last 3 days and I have never been able to see anything on this site. Whenever i go to the link http://www.xfgx.info/ I always get TemplateSyntaxError… Can’t connect to local MySQL server through socket. I hope this is not true for all of Pinax sites.

32 clarissa September 27, 2009 at 11:16 am

thx for the great article. it helps me a lot!

33 Facebook Developers November 13, 2009 at 1:40 am

Template syntax error the first time I tried to use it, worked a few seconds later. Great stuff, but do we really need more social networks?

34 Facebook Applications November 17, 2009 at 4:23 am

It’s good but i think there are already lots of social networking website and that are enough. Yeah but if someone bring something new and interesting so people will definitely gonna use it.

35 Facebook Developer December 10, 2009 at 1:38 am

Creating a social network is good but maintaining a social network and keeping it update on daily basis is not an easy task and there are also many social networking sites like facebook and twitter to whom people are addicted. Thanks for sharing information :)

36 shiv kumar December 23, 2009 at 1:23 am

Social Networking sites are still a good way to promote your blog, website, posts and articles. I use some of great social networking services for promotion of my blog and I get really good results. I suggest my friends to promote their blogs on social networking sites.

shiv kumar

37 Daniel Greenfeld February 2, 2010 at 11:01 pm

This should be going against the bundled 0.7.1 version of Pinax.

38 tony_landis March 18, 2009 at 7:08 pm

Great stuff, but do we really need more social networks?

This comment was originally posted on Reddit

39 f4nt March 19, 2009 at 1:59 pm

No, but there’s lots of useful code here for other projects. Open source ftw.

This comment was originally posted on Reddit

Leave a Comment

Additional comments powered by BackType

Previous post:

Next post: