AlexW
AlexW

Reputation: 2591

docker with python3 and django production image?

Does anyone use docker for a production image of Django, and how do you build that box?

I'm using the base python image with a requirements.txt for development. but id like to use a docker image for production too, but appreciate a web server should be used for this. I've used apache in the past. is there a good approach to this?

Thanks

Upvotes: 0

Views: 244

Answers (1)

kstromeiraos
kstromeiraos

Reputation: 5027

I'm currently using Docker in production with Django. There is not only one valid approach, but there are some components (Docker images) that you're going to need.

  1. WSGI server: This will serve your Django application. Personally, I use gunicorn, but there are other good options.
  2. Web server: You could use the WSGI server to serve your static files, but that's not recommended in production. I use nginx to this, but almost any web server will be suitable for this task. Take a look to this section at Django documentation about serving static files in production (https://docs.djangoproject.com/en/1.11/howto/static-files/deployment/)
  3. Database: Unless your Django app is really simple, you'll need a database.

This are the basic components that you are going to need in a Django app. Each one of this should be a Docker image.

Hope this helps, good luck!

Upvotes: 1

Related Questions