Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

I think that's a good structure but I'm gonna suggest you that don't use django template or any server side template technology. Imagine that in the future you decide (or not you, your boss) to implement some services in other server technology than python/django (ruby/rails, symphony2, J2EE, .NET), that way all you client side html templates are not usable. I think is a good idea to use client side templating like mustache.js and others.

Check this article: "https://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more"

I'm trying to give an example in: "https://github.com/periket2000/sacta-django"

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.