design - Django: best practice for splitting up project into apps -


i'm struggling whole app-idea. read lot of tutorials , style guides , know should try create specialized apps, 1 thing. makes sense when looking @ simple tutorial project gets complex real life project, find myself unable determine how should draw lines between different apps.

one of problems is, want have 1 site (or multiple sites) user sees lot of different stuff. stuff should different apps, when following app design rules. how realize this? first idea create 1 app called ui, handles views lead template , other apps provide models , helperfunctions. fear ui app become way big.

to give small example: lets want have site user can following tasks:

  • select subject
  • set options selected subject
  • upload files associated account
  • assign of uploaded files subject
  • record audio related subject

right now, create 3 apps:

  1. subjects (contains subject model , related models)
  2. resources (contains resource model, handles uploads)
  3. audio (handles audio recording , processing stuff)

but then, need kind of main or ui app handle how these apps interact , create actual site, apps somehow involved.

so, there "right" way this? or there patterns can use? appreciate links resources topic, though read quite few.

you need make sure your structure makes sense you.

there's no requirement create new app every feature bound part of project's logic.

reusable apps whole different story, code should unaware of implementation extend.

take @ django's structure inspiration

a possible layout example:

project_root/     project/         __init__.py         settings.py         urls.py         templates/             app1/  # override stuff         static/         media/     app1/         __init__.py         admin/  # package             __init__.py             subjects.py             resources.py             # etc         models/  # package             subjects.py             resources.py             # etc         managers/             __init__.py             subjects.py             resources.py             # etc         services/             __init__.py             audio.py  # upload handler etc         views/             __init__.py             subjects.py         urls/             __init__.py             subjects.py         templates/             app1/                 subject_list.html  # override @ project level         static/             app1/                 css/                     subject.css  # override @ project level     app2/         __init__.py         models.py  # holds member model or whatever require     manage.py 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -