Monday, October 28, 2013

How to Structure Single App Projects

Hi,

Whenever I am working on small projects, it seems like an overkill to create an app usually with the same name as the website (and the project's name with a small modification). For instance, if I am creating a project for a small intranet application called Foo. I usually end up with a structure like:

foosite/
├── foo
│   ├── __init__.py
│   ├── models.py
│   ├── templates/
│   ├── tests.py
│   └── views.py
├── foosite
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── settings.py
│   ├── settings.pyc
│   ├── urls.py
│   └── wsgi.py
└── manage.py

This seems quite redundant to me. Also foo contains all the assorted things which cannot be reused anyway. Is there a simpler way to implement this? I mean something similar to the original (pre-1.2?) structure of having models, templates and views in the initial directory itself?

Otherwise can we explicitly create models, templates and views in foosite itself and turn it into an app? I like this approach for smaller sites and for functionality which cannot be abstracted into a separate app. Ideally I would've preferred something flat, since "Flat is better than nested".

Would like to know the community's views on this? Any pros and cons would be great too.

Thanks,
Arun

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/24f6c34a-f387-4817-acad-907465c7af8e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment