Dockerizing Masonite with Postgres, Gunicorn, and Nginx

Dockerizing Masonite with Postgres, Gunicorn, and Nginx

This is a step-by-step tutorial that details how to configure Masonite to run on Docker with Postgres. For production environments, we'll add on Nginx and Gunicorn. We'll also take a look at how to serve static and user-uploaded media files via Nginx.

This is a step-by-step tutorial that details how to configure Masonite to run on Docker with Postgres. For production environments, we'll add on Nginx and Gunicorn. We'll also take a look at how to serve static and user-uploaded media files via Nginx.

Masonite is a modern, developer centric, batteries included Python web framework. If you're new to the framework check out the 5 reasons why people are choosing Masonite over Django blog post.

Dependencies:

  1. Masonite v2.2
  2. Docker v19.03.5
  3. Python v3.8.0

Project Setup

Create a project directory, install the Masonite CLI (craft), and create a new Masonite project:

$ mkdir masonie-on-docker && cd masonie-on-docker
$ python3.8 -m venv env
$ source env/bin/activate
(env)$ pip install masonite-cli==2.2.2
(env)$ craft new web
(env)$ cd web
(env)$ craft install
(env)$ craft serve

Feel free to swap out virtualenv and Pip for Pipenv if that's your tool of choice.

Navigate to >http://localhost:8000/ to view the Masonite welcome screen. Kill the server and exit from the virtual environment once done. We now have a simple Masonite project to work with.

Next, before adding Docker, let's clean up the project structure a bit.

Remove the following files from the "web" directory:

  • .env-example
  • .gitignore
  • .travis.yml

Move the .env file to the project folder and rename it to .env.dev.

Your project structure should look like:

dockerizing postgres gunicorn nginx docker masonite

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Dockerizing Django with Postgres, Gunicorn, and Nginx

This tutorial details how to configure Django to run on Docker along with Postgres, Nginx, and Gunicorn.

How to configure Flask to run on Docker with Postgres, Gunicorn, Nginx

This is a step-by-step tutorial that details how to configure Flask to run on Docker with Postgres, Gunicorn, and Nginx

Docker Explained: Docker Architecture | Docker Registries

Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub.

Como configurar o Django com o Postgres, Nginx e o Gunicorn no Ubuntu 20.04

Como configurar o Django com o Postgres, Nginx e o Gunicorn no Ubuntu 20.04. O Django é um framework Web poderoso, que pode ajudar o seu aplicativo Python ou site a decolar. O Django inclui um servidor de desenvolvimento simplificado para testar seu código localmente, mas para qualquer coisa ligeiramente relacionada com produç

How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 20.04

Django is a powerful web framework that can help you get your Python application or website off the ground. Django includes a simplified development server for testing your code locally, but for anything even slightly production related, a more secure