4

I'm using Django Rest Framework for API service and Angular to use those APIs. How do I run Angular alongside Django Rest Framework on the EC2 instance using Amazon Elastic Beanstalk?

For example, Django Rest Framework serves up the API through http://test.com/api/v1/ and Angular makes HTTP requests to those API endpoints client-side.

What are the steps required to run Django Rest Framework API with an angular client side application on the same machine?

Any suggestions would be greatly appreciated!

Steve
  • 4,946
  • 12
  • 45
  • 62

2 Answers2

1

It seems you are looking for a customized container that runs both a Python web app and an Angular app. The angular app accesses the django REST API on "localhost". I would recommend looking into creating a custom Docker container that lets you have this custom configuration.

You can read more on support of Docker containers on Elastic Beanstalk here.

Rohit Banga
  • 18,458
  • 31
  • 113
  • 191
  • Thanks for your answer. Do you more details on setting up the Docker container to the configuration we need? I'm researching it now, but I was wondering if you had any experience with it. – Steve Aug 08 '14 at 19:30
  • A simple walkthrough of setting up a docker application on Elastic Beanstalk. http://aws.amazon.com/blogs/aws/aws-elastic-beanstalk-for-docker/ You can search for docker images that satisfy your usecase here: https://registry.hub.docker.com/ You can also create a new Docker image for your custom needs and then use it. For example you can find a django image and then install stuff needed for angular on top of it in your dockerfile. – Rohit Banga Aug 08 '14 at 19:35
  • Very cool, thanks a lot man! Upvoted your answer, I'll look into it. I'll wait before accepting it as the answer to see if anyone else have any other suggestions, but I appreciate your input! :) – Steve Aug 08 '14 at 20:00
  • I'm working on the same, I'm using nginx container & python:3 container - I will post my shell scripts to rebuild/restart containers on code updates when they are done. – Vincent De Smet Aug 19 '14 at 14:34
  • @Vincent did you get a chance to get it done? Looking forward to seeing it! – Steve Oct 01 '14 at 12:01
  • AWS Elastic Beanstalk only supports a single docker container, i have 2.. I haven't figured out yet if I can deploy 2 containers and easily link them within AWS.. I'm thinking I'm better off with a simple VPS that can run docker. I'm supposed to provide the answer to my team by this Saturday... I wonder if there are complete guides on setting up a micro services app on EB – Vincent De Smet Oct 01 '14 at 14:40
1

While there may be simpler solutions out there I have been able to configure AngularJS + Django REST Framework to run on the same AWS instance. It's the accepted answer to this post https://stackoverflow.com/a/22852451/1759504

There I go into detail on exactly what I had to do to make it so my static AngularJS content runs from http://test.com/#/ while my APIs are at http://test.com/api/v1/

Community
  • 1
  • 1
Steven
  • 1,670
  • 4
  • 17
  • 26