Might sound like a triviality, but sometimes it's the little things.....
1. Newcomers -- startproject throws 9/10 into confusion and results in a messy first few projects.
2. Gurus -- each have their own way, what a waste, not DRY.
3. The new breed of django hosting platforms that are on their way -- gives them something to base their tools on.
Why not have a standard way, standard tools, etc etc- built in, batteries included. DRY.
Whether it be a plain old manage.py-friendly directory layout, something virtualenv+pip powered, maybe something like Lincoln Loop's startproject style, Eric Holscher's, or whatever. Lets not go too nuts on directories though, they get tiring (especially in textmate)
Thoughts?
Sure -- no disagreement that it would be good to have some common
ground with regards to project layout. All we need now is to agree
what that blessed project layout should be. :-)
And there's the rub. There are a bunch of people with different ideas.
For example, take one idea in your list: virtualenv and pip. For many,
this won't be even slightly controversial. But for others, it will be
a complete show-stopper, because there is many a site that enforces a
'package manager only' approach to system adminstration.
So, we have to tread carefully here. At some level, we may just need
to make an executive BDFL call. However, a BDFL isn't going to make a
call until there is a proposal (or three) on the table. What we need
is for someone to drive the discussion and make this happen so that we
are in a position to actually bless something.
For the record, this isn't a new idea, either. Django's tutorial has
said "more coming soon" for as long as I've been involved with Django.
At several times over the last couple of years, there have been
discussions about adding step 5, 6 and more. One of the ideas that is
kicking around is to talk more about project structure, showing how a
reusable app fits into the picture; how pip, virtualenv, tools like
fabric and chef fit into the picture; and so on.
However, writing tutorials takes time, and writing good tutorials takes longer.
So -- if you build it, they will come. Someone just needs to build it :-)
Yours,
Russ Magee %-)
I strongly disagree here. Django shouldn't be doing magic with my
PYTHONPATH, if I want stuff in my PYTHONPATH, I'll darn well put it
there.
>
> Another thing to point out is that a "project" is just an "app" with a
> settings.py file, a media folder, and perhaps a vendor folder.
No, not really. Projects don't have models, for a start.
>
> My big thing is that we should drive home the importance of decoupling
> or loosely coupling your apps. Unless you are 100% certain that you
> will ALWAYS want to bundle an app with your project AND and that you
> will NEVER want to use an app without your project, your other apps
> should exist as separate modules that can be placed anywhere on your
> python path.
>
> If Django were to automatically add the vendor folder to the python
> path as the second folder (after the folder containing your
> settings.py file), it would provide a standard way for users to
> include specific versions of 3rd party apps or their own reusable apps
> that may or may not be installed elsewhere on the hosting environment.
> For example, bundling a specific version of Django to be used even if
> another version of Django is already installed.
This issue is well solved in the python world. It's called virtualenv.
Django should not be replacing standard python processes with Django
magic.
>
> I've recently decoupled a bunch of apps that were initially too
> tightly coupled to a common library that I use in most projects. As
> the apps grew and as we started working on more projects, it became
> troublesome to have to bundle this increasingly large library of apps
> when only a handful would be used by a project, and there were also
> times when I'd have liked to make use of just one in a project that a
> 3rd party had source code access to without giving them access to
> everything.
>
> I wish that I'd learned sooner to always try and build smaller,
> simpler apps with more limited and specific scope that were decoupled
> or more loosely coupled to other apps so that they could be more
> easily reused. Anything that Django can do to make this point more
> obvious would be a good thing.
>
Yep, that is particularly important when writing re-usable code. It's
not just true of 'apps', but also of python libraries, which a django
app is a particular example of.
Cheers
Tom
On 03/17/2011 05:36 AM, Tom Evans wrote:
> I strongly disagree here. Django shouldn't be doing magic with my
> PYTHONPATH, if I want stuff in my PYTHONPATH, I'll darn well put it
> there.
Hear, hear! I'm only a weak +0 on the entire idea of documenting a
"standard" project layout, as I think it's highly idiosyncratic and
dependent on the nature of the project. But I am strongly -1 on any
proposal to introduce any more sys.path-mangling anywhere in Django. I'm
eager to remove the bit that is already there.
Carl
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Likewise. I'd like to spend some time in the 1.4 cycle looking at this
problem; it's an annoying wart, results in startup code that is a lot
more complex (and brittle) than it should, and causes all sorts of
confusion when it comes time to deploy your project.
Yours,
Russ Magee %-)
-1 On django manipulating PYTHONPATH
+1 On encouraging people to keep their applications out of their project!
That sounds handy... I'm in the process of recasting all reusable apps
here to use distutils or distribute ([1][2]) properly "manually". It's
not especially hard, but I wish they'd started out that way because we
have like 14+ of them by now. (Probably mostly never even to be
released, but to be hosted on an internal pypi-alike instance (hey
djangopypi [3]) for centralised deployment).
Aside/bikeshed:
One minor weird Python:TMTOWTDI detail I've noticed arising from the
precise names you chose for your example:
It seems to be a rule perhaps more honoured in the breach - right now,
the pypi list has a very strange mix of lowercaseruntogether, lisp-like
dashes, underscore_separated_lowercase, dot.separated.names, Even Space
Separated, CamelCase,..., - but there does seem to be a current
recommendation that the distribution/project names ("Django") themselves
as distinct from python package names ("django") should be CamelCase [4].
The "django-" prefix in the name of reusable django app distributions
has already emerged as quite widely (but not universally) used, too, and
is obviously lisp-like-dashes not CamelCase, but really I'm not clear
that it's necessary for django apps to have django- in the distribution
name, they'd presumably be categorised Framework::Django anyway if
logged on PyPI. [5]
[1]
http://guide.python-distribute.org/introduction.html#current-state-of-packaging
[2] http://packages.python.org/distribute/
[3] http://pypi.python.org/pypi/djangopypi/
[4]
http://guide.python-distribute.org/creation.html#basics-creating-and-distributing-distributions
[5] http://pypi.python.org/pypi?:action=browse&show=all&c=523