Any good way to programmatically change nginx config file from python?

nginx, python

Solution

Just found out about python-nginx, which works great out-of-the-box using only Python, and doesn't seem to need any C or required Python package at all! Could improve docs a bit. Maybe I'll send a pull request for that.

Problem

I have a python script that dynamically alters nginx config file (`nginx.conf`). Since nginx configuration is not in `ini` format, i currently use some regexp to parse and modify file content. Is it the only way or some better way to programmatically alter nginx configuration exist?

Original source