Front-end structure of large scale Django project

Posted by Saike on Programmers See other posts from Programmers or by Saike
Published on 2014-02-04T18:33:13Z Indexed on 2014/06/01 21:55 UTC
Read the original article Hit count: 697

Few days ago, I started to work in new company. Before me, all front-end and backend code was written by one man (oh my...).

As you know, Django app contains two main directories for front-end: /static - for static(public) files and /templates - for django templates

Now, we have large application with more than 10 different modules like: home, admin, spanel, mobile etc.

This is current structure of files and directories:

FIRST - /static directory. As u can see, it is mixed directories with some named like modules, some contains global libs.

static dir

one more:

static dir second

SECOND - /templates directory. Some directories named like module with mixed templates, some depends on new version =), some used only in module, but placed globally.

templates dir

and more:

templates dir 2

I think, that this is ugly, non-maintable, put-in-stress structure!

After some time spend, i suggest to use this scheme, that based on module-structure.

enter image description here

At first, we have version directories, used for save full project backup, includes: /DEPRECATED directory - for old, unused files and /CURRENT (Active) directory, that contains
production version of project.

I think it's right, because we can access to older or newer version files fast and easy. Also, we are saved from broken or wrong dependencies between different versions.

Second, in every version we have standalone modules and global module.

Every module contains own /static and /templates directories. This structure used to avoid broken or wrong dependencies between different modules, because every module has own js app, css tables and local images.

Global module contains all libraries, main stylesheets and images like logos or favicon.

I think, this structure is much better to maintain, update, refactoring etc.

My question is:

How do you think, is this scheme better than current? Can this scheme live, or it is not possible to implement this in Django app?

© Programmers or respective owner

Related posts about architecture

Related posts about python