5

I create a pretty big Django project for my own and want to implement AngularJS on frontend and some rest framework on backend. I know that the project will implement at least 7-8 my own apps (I think that django apps should be small and responsible for one functionality).

I've never used AngularJS before - but I want to create good architecture. So just one django app should have one angular app?

| - Django project
|--- app1
|------ angular_app1
|---------angular controller1
|---------angular controller2
|--- app2
|------ angular_app2
|---------angular controller1
|---------angular controller2

Or maybe I should have one global angular app for whole project and single django apps should register theirs controllers in view? I think that it can be usefull when we want to use a module from other app.

| - Django project
|--- angular app
|--- app1
|-------angular controller1
|-------angular controller2
|--- app2
|-------angular controller3
|-------angular controller4

Or maybe I'm still wrong?

2 Answers 2

5

I actually recently built a huge application using Django and AngularJS.

I used DRF for the rest services. Going through the architecture, i decided to serve Angular within the context of Django itself. So my project structure looked like follows

| - Django project
    --DjangoApp1
    --DjangoApp2
    --DjangoSettingsDir
    --static
        --assets/
            --JS/
                -- controllers/
            --partials/
    --templates //base Django templates
         --index.html

Served index.html at / using simple Django render. Used Angular, UI Router, UI Bootstrap etc within index.html to build the app.

Sign up to request clarification or add additional context in comments.

3 Comments

Whole project was SPA? I thought about 1 django app = 1 django view (template i mean) and all of subviews make with Angular. What you think?
Yeah that's exactly what I've done. Added a Ui-view directive in the main template and used it from there.
Assuming you are using npm like tools for development, How do you deploy your js static files on production server?
0
`| - 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.css

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.