Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best project structure for django & angularjs

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?

like image 661
tomeusek Avatar asked Jul 18 '15 09:07

tomeusek


People also ask

Is Django good for big projects?

Built on top of the Python language, Django encourages fast development process, is secure, scalable and has a clean and simple design. As of today, Django apps are extensively leveraged for projects involving AI, Machine Learning, and Big Data. Django applications include both frontend and backend.

What is the structure of Django?

Every website has three main code sections: input logic, business logic, and user interface logic. The code has certain functions to perform, the input data is the dataset and how it is stored in the database.


1 Answers

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.

like image 79
Newtt Avatar answered Sep 28 '22 22:09

Newtt