amrox
amrox

Reputation: 6247

Django project layout guidance for main site, mobile site, and API

I'm relatively new to Django and am having difficulty laying out my project. Let's say it's for user-created movie reviews (it's not). Here are the main components:

All these components share the same model, so it's pretty clear that they belong in the same project. My question is, are the browser-app and API Django apps or sites?

Upvotes: 1

Views: 407

Answers (2)

Keith Fitzgerald
Keith Fitzgerald

Reputation: 5701

It took me a few projects to fully grok the intended app/project layout (http://www.b-list.org/weblog/2006/sep/10/django-tips-laying-out-application/) but once I started following this pattern, everything became much simpler.

Each app should be a isolated concern though not necessarily fully independent. I'm not sure I'd create a project that had a "main" app and a "mobile" app. I'd rather segment based on concern such as: account mgmt, search, etc. And in each of those apps, I would expose urls specifically used for mobile.

It's especially helpful for team development and managing migrations. If you just have one app and the team is generating multiple migrations in a sprint, it can become unwieldy to coordinate.

Hope this makes sense.

Upvotes: 1

Nikolay Fominyh
Nikolay Fominyh

Reputation: 9246

My way to solve this problem:

  1. Develop API of service. SimpleAPI fits good for it.
  2. Develop site using API methods.
  3. Develop mobile using API methods.
  4. Decide, what methods of API can be shared with external sites.

Upvotes: 0

Related Questions