Cloned my project, what to do next?

4 views
Skip to first unread message

Andy

unread,
Oct 13, 2009, 12:33:10 AM10/13/09
to Pinax Users
Hi,

I'm new to Pinax. Thanks for the great project!

I followed the doc and installed Pinax and cloned my (social)
project.

Now I'm at a loss. The doc is not exactly clear on what to do next.

A few questions:

1) under ~/virtualenv/pinax-env/myproject/apps there are only 3 apps:
about, friends_app, tag_app. Where do all other apps (eg. django-
timezones, django-threadedcomments) live? And why aren't they all in 1
place?

2) Same with the templates ~/virtualenv/pinax-env/myproject/templates
dir, which only contains templates for about, account, notification,
photos, tags. Where are the templates for all other apps?

3) In the doc (http://pinaxproject.com/docs/0.7/customization.html),
it states that:
"In the sample projects, templates/base.html is intended for overall
page structure whereas templates/site_base.html is intended for adding
site-specific content that is to be found on all pages"
I only see site_base.html but no base.html under the templates dir. Am
I missing something?

4) If I want to write my own features, where should i put the views,
models, templates? In a normal django project I'd use the "manage.py
startapp" command to create an app directory. Do I do the same in
Pinax, in the ~/virtualenv/pinax-env/myproject/ dir?

5) If I want to add an external apps to Pinax what's the best way to
do it? For example I'm interested in adding django-socialauth (http://
github.com/uswaretech/Django-Socialauth). How would I integrate that
into Pinax?

6)What do I need to do to change the look and feel of Pinax?

There're a great number of files installed by Pinax and I'm a bit
overwhelmed. Is there a "guided tour to Pinax" that can give me a
sense of the structure of Pinax and how everything relates to each
other?

Thanks
Andy

Brian Rosner

unread,
Oct 13, 2009, 1:28:25 AM10/13/09
to pinax...@googlegroups.com

On Oct 12, 2009, at 10:33 PM, Andy wrote:

> I followed the doc and installed Pinax and cloned my (social)
> project.
>
> Now I'm at a loss. The doc is not exactly clear on what to do next.

[writing this after writing response] You've illustrated some
excellent questions we should improve upon in documentation. Hopefully
I've answered them at some level of detail. Let me know if you have
further questions.

> 1) under ~/virtualenv/pinax-env/myproject/apps there are only 3 apps:
> about, friends_app, tag_app. Where do all other apps (eg. django-
> timezones, django-threadedcomments) live? And why aren't they all in 1
> place?

The apps you are seeing in your project are apps that are project-
specific. They are not required by anything other than the project
itself (social_project). When you installed Pinax (running pinax-
boot.py) it created a virtual Python environment. You named it pinax-
env (as the documentation tells you). This directory is intended for
the Python environment only. You cloned the social_project inside the
environment directory. This isn't a great idea as it has a conceptual
flaw. You wouldn't clone projects in /usr would you (effectively the
root of the global Python environment)? That aside, pinax-boot.py has
a list of external apps it must install to create a functional Python
environment for Pinax projects. Let's say that list contains only the
apps django-tagging and django-timezones. Under the hood it runs the
equivalent of:

pip install django-tagging
pip install django-timezones

inside the virtual environment. It doesn't run those commands as-is as
we've made some modifications to allow for the environment to be
created without requiring an Internet connection. The result being
they are installed in the environment for you.

>
> 2) Same with the templates ~/virtualenv/pinax-env/myproject/templates
> dir, which only contains templates for about, account, notification,
> photos, tags. Where are the templates for all other apps?

Similar to project specific apps these are project specific templates.
Back in the day we use to have a ton of duplicated templates at the
project level. This made it a headache for us to keep them up to date
as we added new projects. They've since been refactored as default
base templates. We are working on better documentation that documents
each template. The idea is if you need to make a customization to a
template you simply override it at the project level. This is how
Django's template loading works. If you look at your TEMPLATE_DIRS
setting you can see exactly the order and where Pinax templates live.
Additionally, look at the TEMPLATE_LOADERS setting which outlines
which template loaders to use and in what order. TEMPLATE_DIRS is tied
to the django.template.loaders.filesystem.load_template_source
template loader.

>
> 3) In the doc (http://pinaxproject.com/docs/0.7/customization.html),
> it states that:
> "In the sample projects, templates/base.html is intended for overall
> page structure whereas templates/site_base.html is intended for adding
> site-specific content that is to be found on all pages"
> I only see site_base.html but no base.html under the templates dir. Am
> I missing something?

As I mentioned above, we did a refactor of the templates that used to
live at the project level into default base templates. At the time
when more templates were in the project base.html was one of them. The
section you are reading in the customization documentation is dated.
We certainly need to update it to reflect current state.

Essentially, what it should say that if you want to modify overall
site structure you should likely override these blocks or override the
entire template in your project. At present I don't have that list of
blocks to override, but take a look at the default base.html — http://github.com/pinax/pinax/blob/0.7.X/pinax/templates/default/base.html

>
> 4) If I want to write my own features, where should i put the views,
> models, templates? In a normal django project I'd use the "manage.py
> startapp" command to create an app directory. Do I do the same in
> Pinax, in the ~/virtualenv/pinax-env/myproject/ dir?

Nothing really changes here. The only issue is that we recommend you
put project specific apps in the project apps/ directory and startapp
creates them project directory level. The reason this is critical is
because many people end up relying that their project directory is put
on the sys.path. This is true in manage.py, but isn't the case in any
other environment (such as deployment with mod_python or mod_wsgi).
This can lead to deployment issues and questions such as, "It worked
in runserver, but mod_wsgi can't find my apps".

>
> 5) If I want to add an external apps to Pinax what's the best way to
> do it? For example I'm interested in adding django-socialauth (http://
> github.com/uswaretech/Django-Socialauth). How would I integrate that
> into Pinax?

Installation should be as easy as using pip to install them in your
environment. We've tried very hard to ensure many Django external apps
follow Python packaging guidelines allowing them to be installed with
pip. We've done this with all external apps installed by Pinax. Be
sure to read the app's documentation regarding installation and if it
doesn't involve using easy_install (yuck) or pip then the app author
should be notified to add such support or at least document it!

Integration is going to be very specific to the app. The particular
app you mention may need to interact with Pinax specific stuff to
work. I've never looked at it so I cannot comment if this is true.
However, I can say we will be adding more authentication types
(Facebook and Twitter) in the near future. We already support OpenID
out of the box. It may be worth waiting.

>
> 6)What do I need to do to change the look and feel of Pinax?

I don't normally do this sort of modifications to Pinax installation I
work on. I will say that it should be as easy as coordinating some
template changes with CSS. I'll leave this question to those who have
better working knowledge of this.

>
> There're a great number of files installed by Pinax and I'm a bit
> overwhelmed. Is there a "guided tour to Pinax" that can give me a
> sense of the structure of Pinax and how everything relates to each
> other?

Not quite yet. We are continually improving the documentation and
suggestions like this (though more specific ones are better) are
greatly appreciated. If you head on over to http://
code.pinaxproject.com (create an account) file some tasks to help
improve Pinax!


Brian Rosner
http://oebfare.com
http://twitter.com/brosner

Andy

unread,
Oct 13, 2009, 2:25:17 AM10/13/09
to Pinax Users
Brian,

Thanks for the quick & detailed response.

I'm still adsorbing the information so I'm sure I'll have more
questions later. But I have 2 quick questions for now.

On Oct 13, 1:28 am, Brian Rosner <bros...@gmail.com> wrote:
> You cloned the social_project inside the  
> environment directory. This isn't a great idea as it has a conceptual  
> flaw.

So I shouldn't clone my project inside pinax-env?

But that is what the doc uses as an example - http://pinaxproject.com/docs/0.7/install.html
:
"(pinax-env)$ pinax-admin clone_project social_project mysite"

What is the best directory in which to clone my project then?

 
> However, I can say we will be adding more authentication types  
> (Facebook and Twitter) in the near future. We already support OpenID  
> out of the box. It may be worth waiting.

This is great news! When is Pinax expected to have facebook & twitter
support? As a beginner I'd much rather not messing with the
authentication system if the wait is not too long.

wongobongo

unread,
Oct 13, 2009, 7:32:44 AM10/13/09
to Pinax Users
I think that it is easy to infer that you can just go through the
steps top to bottom and be done with it, like you would do in a quick
start guide, but at the end of the "Installing Pinax" section, you are
still in the extract directory. Then, in "Activating the virtualenv"
you are still in the extraction directory. Then in "Starting a new
Pinax project" it gets fuzzy. At one point, it says: "...once you are
in your Pinax virtual-env." That sounds like the directory you just
created, but it is not. I think that it means, once you have your
virtual-env running and they do not mean that you should have "pinax-
env/" as your current working directory. You're still in the
extraction directory from the last step and your pinax-env is in the
next directory over.

The docs then say: "Just as quick demonstration, let's start with the
social_project. cd into the
directory you'd like to create your new project in and run..."

The key point is that you need to figure out where you want your
project files to be. If people are just trying the software out, I
don't think that they would have much of an opinion either way where
their app should be. I certainly didn't when I first started playing
with this software. I'd suggest adding something like...

"Avoid creating your project directories within the folder that holds
your environment files (the folder we created named 'pinax-env')
because it interferes with the correct operation of the software. You
should create it elsewhere. For this example, we'll create a
'social_project' in the parent directory of the folder where you
extracted the pinax archive...

(pinax-env) $ cd ..
(pinax-env) $ pinax-admin clone_project social_project mysite
..."

I think that a walk-through would be very helpful to get people
introduced to python, django, virtual env and all the other
technologies used to make a pinax project.

K



On Oct 12, 11:25 pm, Andy <selforgani...@gmail.com> wrote:
> Brian,
>
> Thanks for the quick & detailed response.
>
> I'm still adsorbing the information so I'm sure I'll have more
> questions later. But I have 2 quick questions for now.
>
> On Oct 13, 1:28 am, Brian Rosner <bros...@gmail.com> wrote:
>
> > You cloned the social_project inside the  
> > environment directory. This isn't a great idea as it has a conceptual  
> > flaw.
>
> So I shouldn't clone my project inside pinax-env?
>
> But that is what the doc uses as an example -http://pinaxproject.com/docs/0.7/install.html

Andy

unread,
Oct 13, 2009, 8:57:24 PM10/13/09
to Pinax Users
Let me make sure I understand.

I have a directory structure like this: virtualenv/pinax-env

Right now I my mysite located as: virtualenv/pinax-env/mysite

The better way is to have: virtualenv/mysite, basically having pinax-
env and mysite parallel to each other. is that right?

Thanks.

William Shallum

unread,
Oct 13, 2009, 9:53:01 PM10/13/09
to pinax...@googlegroups.com
You can put mysite anywhere you want e.g. $HOME/sites/mysite. Since
mysite is not a virtualenv, it would not be very appropriate to put it
alongside pinax-env.

grant neale

unread,
Oct 14, 2009, 3:52:14 AM10/14/09
to pinax...@googlegroups.com
This is an answer James Tauber gave me regarding your question:

> The short answer is: it doesn't matter where you put the project but
> we suggest you DON'T put it in the virtualenv.
>
> On our production servers, we have
>
> ~/webapps/<site_name>/<project>
>
> and
>
> ~/virtualenvs/<site_name>
>
> in parallel and I use a very similar parallel structure in development
> too.
>
> Note: we use virtualenv_wrapper so can switch to a virtualenv for a
> site with "workon <site_name>"
>
>
> James

Thomas Gautier

unread,
Oct 16, 2009, 3:03:53 PM10/16/09
to Pinax Users
There's something I don't get. Since pinax-env is in itself a
virtualenv, should my new project by in the same virtual-env (even if
not in the same directory) or I should create a new virtualenv for my
project.

Today I have ~/virtualenv/pinax-env and ~/virtualenv/my-project but my-
project is almost an empty django project so if I want to use it I
have to first do a "source ~/virtualenv/pinax-env/bin/activate and
then go to ~/virtualenv/my-project

I don't know if I'm very clear but I don't get why my-project
directory shouldn't be in the same directory as pinax-env since it's
anyway in the same virtualenv otherwise my-project is just an empty
shell.

Steve Schwarz

unread,
Oct 17, 2009, 8:27:18 AM10/17/09
to pinax...@googlegroups.com
On Fri, Oct 16, 2009 at 2:03 PM, Thomas Gautier <thomas....@gmail.com> wrote:
I don't know if I'm very clear but I don't get why my-project
directory shouldn't be in the same directory as pinax-env since it's
anyway in the same virtualenv otherwise my-project is just an empty
shell.

If I understand your question... My thinking is virtualenv is just a convenience for collecting together the packages at specific versions for use in supporting my project. By separating my project (in a different directory from the virtualenv) I can version control my project separately from the environment in which it runs. This separation allows me to experiment with changing/upgrading/downgrading any of the packages on which my project depends. It is also likely a project wouldn't end up staying an empty directory for long, there is always something that would need some customization...

Best Regards,
Steve
http://googility.com/

James Tauber

unread,
Oct 17, 2009, 3:57:30 PM10/17/09
to pinax...@googlegroups.com
You only need *one* virtualenv but your project shouldn't be in that
virtualenv. It should be in a different directory. This enables you to

a) version your project separately from your Pinax environment
b) blow away / upgrade your Pinax environment / try different Pinax
versions, etc without affecting your project

James

JD

unread,
Oct 17, 2009, 5:04:12 PM10/17/09
to pinax...@googlegroups.com, pinax...@googlegroups.com
Considering the recent frequency of this question, it should probably
be made more clear in the docs.

I'd add it, but I'm typing this from a phone.

Thomas Gautier

unread,
Nov 5, 2009, 1:43:47 PM11/5/09
to Pinax Users
I've seen the changes on the documentation, it's a lot more clear now,
thanks :)

On Oct 17, 10:04 pm, JD <j...@j2labs.net> wrote:
> Considering the recent frequency of this question, it should probably  
> be made more clear in the docs.
>
> I'd add it, but I'm typing this from a phone.
>
Reply all
Reply to author
Forward
0 new messages