简体   繁体   中英

How to setup gunicorn with nginx while using aws elastic beanstalk for a django app

I have searched through many resources but I haven't found a well-detailed way to set up a Django app on elastic beanstalk using Gunicorn and Nginx with RDS as a database. There are resources available for using it on ec2 machines directly but not through elastic beanstalk.

  1. What steps do I need to follow to make it happen

Also some of the questions I have,

  1. Do we need Nginx when using Django with beanstalk? as beanstalk comes with its own load balancers
  2. I know Django comes with an admin panel which is not a part of Angular. If I were to serve an Angular app through s3 and CloudFront do we still need Nginx to serve static assets? how big of a role does nginx play here?
  3. How many processes/workers and threads are idle for a micro ec2 machine that comes with aws free tier?

thank you in advance

The official instructions on setting up basic django on EB are:

The instructions are valid as I used them myself. Thus I can verity they work.

You question is too generic to provide detailed answer for everything. But in short, nginx is bundled with EB, so you don't have to do anything. You can customize it to your needs, but no installation is required. Nginx is still used, even if you have load balancer in EB.

Nginx is essential component in EB. It would be difficult to work in EB without it. If you don't want it, maybe easier to setup your own EC2 instance with exactly what you require.

t2.micro has only 1 CPU. AWS does not limit on how many threads or processes you can run. Its dependent on your app and if 1 CPU and 1GB of memory is sufficient for that.

There are two ways of using RDS with on EB. First, is by bundling RDS with EB, second, the recommended, is to use external RDS with EB.

Going from the other comments, I am going to just first say, make sure you note that some previous answers will be different as AWS Linux 2 is being pushed and it is completely different from the previous version.

And from that I will share with you this Command 01_migrate failed on Amazon Linux 2 AMI

Which is what I needed to do to resolve most of my django + eb + aws linux 2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM