我为自己创建了一个非常大的Django项目,并希望在前端实现AngularJS,在后端实现一些rest框架。我知道该项目将实现至少7-8个我自己的应用程序(我认为django应用程序应该很小,并负责一种功能)。
我以前从未使用过AngularJS --但我想创建一个好的架构。所以只有一个django应用程序应该有一个angular应用程序?
| - Django project
|--- app1
|------ angular_app1
|---------angular controller1
|---------angular controller2
|--- app2
|------ angular_app2
|---------angular controller1
|---------angular controller2或者我应该为整个项目使用一个全局的angular应用程序,并且单个django应用程序应该在视图中注册它们的控制器?我认为,当我们想要使用其他应用程序中的模块时,它可以很有用。
| - Django project
|--- angular app
|--- app1
|-------angular controller1
|-------angular controller2
|--- app2
|-------angular controller3
|-------angular controller4或许我还是错了?
发布于 2015-07-18 18:05:42
实际上,我最近使用Django和AngularJS构建了一个巨大的应用程序。
我将DRF用于rest服务。通过整个架构,我决定在Django本身的上下文中为Angular服务。所以我的项目结构如下所示
| - Django project
--DjangoApp1
--DjangoApp2
--DjangoSettingsDir
--static
--assets/
--JS/
-- controllers/
--partials/
--templates //base Django templates
--index.html在/上使用简单的Django render服务于index.html。在index.html中使用Angular,UI Router,UI Bootstrap等来构建应用程序。
发布于 2015-07-18 20:38:15
`| - Django project
--DjangoApp1
--DjangoApp2
--DjangoSettingsDir
--static
--bower_component/
--all Javascript Library/
--node_build
--all node files or npm files(if required)
--templates
--all custom HTML files
--JavaScript
--all custom JavaScript files
--Style
--all custom CSS files goes here
--templates //base Django templates
--index.html`
--index.js
--index.csshttps://stackoverflow.com/questions/31489849
复制相似问题