Front-end structure of large scale Django project [closed]

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

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 you 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-maintainable, 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 style-sheets 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?

1

By “module”, do you mean app? Django already has a pretty standard structure for where to place files.

I suggest you consider using that structure. For one thing, just about all help you will get will have examples with this structure.

As for your structure, it looks pretty sprawling to me. It’s up to you, though. In particular if it fits the business problem, you won’t have issues navigating it.

The points that look ugly to me:

  1. Why not a Version Control System? Keeping versions on the local file system is not pretty. You can use versioning systems and add 3rd party javascript/css libraries too so added/removed/replaced javascript and css files will be trackable. You go go back or forth between revisions and check the differences easily.
  2. It is hard to develop a software whose modules needs different versions of the same 3rd party software. If your admin module need jQuery X while
    Products module needs jQuery Y, then you have problems. It is hard to maintain and it would be only you who knows why each module need specific version of jQuery X and why it can not run under jQuery Y. Since you have a full copy of each deployment on your local drive, You probably will not remember why A module is needing a specific bootstrap version. For different js/css files which are specific to a single module, you can create static directory under each application and place application-specific files in here. See this post as a reference
  3. Django have a well-planned template structure. You can do the same as you did to static files. You may have templates directory under each application and palce application-specific templates in here.
  4. Having application-specific templates and static directories is up to the developer. If having all files under the same directory looks ugly then you can choose the application-specific solution. Django will handle them both nicely. Especially if you have a lot of applications then you may have name collusions if all of your templates and static files are under the same directory.

Current form is much better than the old one. But I am sure you may get more better ideas if you check the Django docs and check SO/programmers for similar situations and solutions.

Yes. It is much better then how it was done previously. Moreover Django is also the right tool to do it. The reason for the same is, when we look at the base of the framework i.e. Django is this case is written in Python. Python believes more in Readability rather then writing the code itself.

So, yes the things you have done is much better in simple terms

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”

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Front-end structure of large scale Django project [closed]

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

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 you 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-maintainable, 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 style-sheets 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?

1

By “module”, do you mean app? Django already has a pretty standard structure for where to place files.

I suggest you consider using that structure. For one thing, just about all help you will get will have examples with this structure.

As for your structure, it looks pretty sprawling to me. It’s up to you, though. In particular if it fits the business problem, you won’t have issues navigating it.

The points that look ugly to me:

  1. Why not a Version Control System? Keeping versions on the local file system is not pretty. You can use versioning systems and add 3rd party javascript/css libraries too so added/removed/replaced javascript and css files will be trackable. You go go back or forth between revisions and check the differences easily.
  2. It is hard to develop a software whose modules needs different versions of the same 3rd party software. If your admin module need jQuery X while
    Products module needs jQuery Y, then you have problems. It is hard to maintain and it would be only you who knows why each module need specific version of jQuery X and why it can not run under jQuery Y. Since you have a full copy of each deployment on your local drive, You probably will not remember why A module is needing a specific bootstrap version. For different js/css files which are specific to a single module, you can create static directory under each application and place application-specific files in here. See this post as a reference
  3. Django have a well-planned template structure. You can do the same as you did to static files. You may have templates directory under each application and palce application-specific templates in here.
  4. Having application-specific templates and static directories is up to the developer. If having all files under the same directory looks ugly then you can choose the application-specific solution. Django will handle them both nicely. Especially if you have a lot of applications then you may have name collusions if all of your templates and static files are under the same directory.

Current form is much better than the old one. But I am sure you may get more better ideas if you check the Django docs and check SO/programmers for similar situations and solutions.

Yes. It is much better then how it was done previously. Moreover Django is also the right tool to do it. The reason for the same is, when we look at the base of the framework i.e. Django is this case is written in Python. Python believes more in Readability rather then writing the code itself.

So, yes the things you have done is much better in simple terms

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”

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật