On Thursday 18 June 2009 06:07:59 pm Wiiboy wrote: > Right. > > I was wondering what would be best. Would it make sense to have that > be it's own app? >
I've found that's whats best is what is best for you and those who will be
maintaining it. If you don't know what's best, you should experiment a bit
and find 'your groove'.
For me I first get a piece of paper and pen and outline the website, then
disect it out and see what applications are available for that app and if
they meet the requirements, if not, look at what it'll take to make it work.
For example:
My Blog:
I. Blog Functionality
A. define urls
B. define models
C. define views
D. define templates
E. extras such as template tags and the like.
II. Comment
III. Registration
IV. Contact Form
V. About
VI. Social Services (app to intergrate into various social networking
sites)
VII. Needed Urls
In the above example, each major point, gets the same subpoints. Blog should
be it's own app, comments can be provided by django.contrib.comments,
registration by django-registration, contact form and about can be combined
into one single app or be a part of news, and social services, can also be a
part of the news or a single app. I then tinker this till I have a great idea
of what the website will be and this will help define the project directory
layout.
We aren't robots and we do have different likes and dislikes and ways of doing
things. So don't be afraid to be yourself, while working within the hard
constraints of the framework. If you feel that part of the website should be
it's own app, then go with it, if it can fit with another app, then go with
that.
To tell the difference, ask yourself, Why would this be better as it's own
app? When you can answer this, you'll know. But the only real concern you
should have when asking this question is, those who will be maintaining the
website, what would be best for them.
With apps such as django-registration and django.contrib.comments, these live
globably in my pythonpath and in use in other sites and don't need to a part
of my project directory.
Then I would assemble the project directory to match what I came up with.
In this case:
myproject
blog
socialservices
basics
basics combine contact and the about stuff in one app, since they are small
apps and in my mind are providing similar basic services most websites
provide. (Most people here would probably use flatpages and/or genric views
for the about page, I'm using it for an example).
My installed applications setting would look something like this:
INSTALLED_APPS = (
# django provided apps
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.comments'
# 3rd party apps
'registration', # django-registration
# our custom apps
'base',
'blog',
'socialservices',
)
Then build according to my outline.
Note to those who would mention django-social, instead of writing a custom
one, I am just providing examples for explaining my point of view on how to
tell what should be an app and how to lay it out.
Mike
--
You know you're in trouble when...
(1) Your car horn goes off accidentally and remains stuck as you
follow a group of Hell's Angels on the freeway.
(2) You want to put on the clothes you wore home from the party
and there aren't any.
(3) Your boss tells you not to bother to take off your coat.
(4) The bird singing outside your window is a buzzard.
(5) You wake up and your braces are locked together.
(6) Your mother approves of the person you're dating.
signature.asc
Description: This is a digitally signed message part.

