Search code examples
djangogitiisgithub-webhook

Run "git pull" for a Django project running on Windows Server 2016 IIS


My current set up has a Django project running on Windows 2016 IIS.

The project is hosted on GitHub for collaboration and I would like to set up a GitHub webhook so whenever there's a push to master branch from any of the collaborators, the IIS Server will run a "git pull" to update the project on the server.

What is normally the setup for this?

What I have tried so far is to create an endpoint in the Django project, this endpoint whenever called will run Python subprocess to run "git pull" command in the project itself. However, whenever I run it, it get a 500 response from IIS.


Solution

  • Thanks @VonC for helping.

    I have looked to the log (which was the one in XML) but it wasn't much help.

    What I'm posting here was my workaround, not exactly to the answer for the question above.

    I used django-background-tasks to add the command subprocess.run(['git', 'pull']) as a task to run later (after a few seconds after that by the @background decorator).