Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Angular Universal with a Python/Django backend #654

Closed
2 of 10 tasks
ravi1078 opened this issue Jan 14, 2017 · 12 comments
Closed
2 of 10 tasks

Enable Angular Universal with a Python/Django backend #654

ravi1078 opened this issue Jan 14, 2017 · 12 comments

Comments

@ravi1078
Copy link

ravi1078 commented Jan 14, 2017

Note: for support questions, please use one of these channels: https://github.com/angular/universal/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports. Also, Preboot has moved to https://github.com/angular/preboot - please make preboot-related issues there.

  • I'm submitting a ...
  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.
  • What modules are related to this Issue?
  • express-engine
  • grunt-prerender
  • gulp-prerender
  • hapi-engine
  • universal-next
  • universal
  • webpack-prerender
  • Do you want to request a feature or report a bug?

  • What is the current behavior?

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem by creating a github repo.

  • What is the expected behavior?

  • What is the motivation / use case for changing the behavior?

  • Please tell us about your environment:

  • Angular version: 2.0.0-rc.X
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5 ]
  • OS: [all | Mac OS X | Windows | Linux ]
  • Platform: [all | NodeJs | Java | PHP | .NET | Ruby]
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
@MarkPieszak
Copy link
Member

Just leaving this as a reference (http://sweetme.at/2014/02/17/a-simple-approach-to-execute-a-node.js-script-from-python/) on executing a node script from Python.

@jeffwhelpley jeffwhelpley changed the title Server side rendering for django as a backend Enable Angular Universal with a Python/Django backend Jan 23, 2017
@mattpepin
Copy link

This would be awesome. Also, please make it generic enough so that it's not tied to a specific framework (ie Django only). There are many other great platforms (Pyramid/Pylons, Flask, etc)!

@MarkPieszak
Copy link
Member

If anyone is interested in contributing to the Python integration let me know.
If you have any experience with Dukpy (https://github.com/amol-/dukpy) that'd be helpful as well!

@fazpu
Copy link

fazpu commented Jul 3, 2017

I am very interested, especially in the Django use. @MarkPieszak -I am not sure if it is going to be any use, but you might have a look on how it is done for the react equivalent - https://github.com/markfinger/python-react.

Out of curiosity - what is the intended approach toward integration with the Universal?

@jykae
Copy link

jykae commented Aug 28, 2017

agree with @mattpepin
Make it general use python Angular component renderer.

@Oneia
Copy link

Oneia commented Oct 20, 2017

We are using only a django for back-end code in our company and it would be fine to have a ssr. I didn't work with duckpu but I work with angular for 1 year. I want to help where I can.

@Abby3017
Copy link

Abby3017 commented Nov 8, 2017

Its a great initiative to provide integration with django. I have worked on angularjs and angular2 extensively and used django as backend for my project. If you can tell me how to work on this approach, I will be happy to work on this guys.

@fazpu
Copy link

fazpu commented Nov 12, 2017

@MarkPieszak - I would also like to contribute. Do you have any suggestions where/how to start?

@ghost
Copy link

ghost commented Nov 24, 2017

Hi guys I use Flask , i am good on flask and i planning to use flask not Django

@fazpu
Copy link

fazpu commented Dec 7, 2017

For everybody who gets to this ticket, I would like to share my findings.

We are currently implementing Angular with Angular Universal to a large e-commerce site. The backend is written in .NET, hence we were considering to use the .NET engine of Universal. Turns out the solution is bad compared to the Express, especially in terms of performance.

Here are results done with ab testing (1000 requests, 100 concurrent users).

Rendered components on page 1 60 600 1800
.NET – response (ms) 9 15 42 113
Express (NodeJS) – response (ms) 5 9 33 99
.NET slower by 80.00% 66.67% 27.27% 14.14%

What I am trying to say is the Express engine works very well and there is no need to have a separate Python engine for Universal.
Hence, the solution is to have a node.js server next to Python API server.

The workflow is then following:
1 - request comes to load balancer (e.g. Nginx)
2a - If the request URI starts with /api, the request is sent to the Python API server
2b - If the request URI is anything else, the request is passed to the node.js server

It is important to undestand that the node.js does only the following:

  1. it passes the request to the Angular Universal
  2. Angular asks for data to the Python API server if necessary
  3. the rendered HTML is returned

=> Use Python API server along the node.js sever

@CaerusKaru CaerusKaru added this to the Backlog milestone Mar 7, 2018
@Toxicable
Copy link

Closed in favour of #1000

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants