python - Angular Gulp with Nginx on AWS on Ubuntu -


i have been developing website has structure follows -

  • django rest app backend serves json front-end according has been requested.
  • angularjs app frontend requests apis.

now both backend , frontend not coupled in way , locally used manage.py runserver backend , gulp serve frontend.

i moving development , have set nginx aws run django , cater api requests, working fine.

but frontend, confused as-

  • what gulp serve is, injects scss , dependencies , starts app. how start app using nginx(basically gulp serve)?

how django , angular runnung on nginx on same instance? nice if post examples too.

what can make django serve base template through view.

now base template should contain main angular app. contain angular dependencies such libraries , controllers/service/directives etc.

<!doctype html>  <html lang="en" ng-app="angularapp">    {% block head %}  <head>                {% block angular_requirements %}          <script type="text/javascript" src="{{ static_url }}node_modules/angular/angular.js"></script>          <script type="text/javascript" src="{{ static_url }}node_modules/angular-ui-router/release/angular-ui-router.js"></script>          <script type="text/javascript" src="{{ static_url }}node_modules/checklist-model/checklist-model.js"></script>                  <script type="text/javascript" src="{{ static_url }}angular_apps/dashboard/app.js"></script>          <script type="text/javascript" src="{{ static_url }}angular_apps/controllers/dealcontroller.js"></script>          <script type="text/javascript" src="{{ static_url }}angular_apps/controllers/catcontroller.js"></script>          <script type="text/javascript" src="{{ static_url }}angular_apps/dashboard/controllers.js"></script>          <script type="text/javascript" src="{{ static_url }}angular_apps/dashboard/services.js"></script>          <script type="text/javascript" src="{{ static_url }}angular_apps/dashboard/utils.js"></script>          <script type="text/javascript" src="{{ static_url }}angular_apps/dashboard/filters.js"></script>      {% endblock angular_requirements %}      </head>  {% endblock head %}    <body>           </body>    </html>

keep in mind base template reside in django templates folder , angular file reside in static folder.

now, base template served django view , static files served via nginx.

you'll have add static rule in nginx conf:

location /static/ {          alias  <path-to-collect-static-folder>;     } 

so folder structure can this:

django-app/     app/     templates/         base.html     static/         node_modules/ # contain libraries         angular_app/             app.js             controllers.js 

here project has django backend angular frontend: https://github.com/aliasav/coder-submissions


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -