Skip to content

Instantly share code, notes, and snippets.

@mklasen
Last active June 27, 2021 13:22
Show Gist options
  • Save mklasen/0a21dd38549826981a30d965e449d8c6 to your computer and use it in GitHub Desktop.
Save mklasen/0a21dd38549826981a30d965e449d8c6 to your computer and use it in GitHub Desktop.
Automatically reloading a python script upon file changes with nodemon
import os
from inc.test1 import var1
from inc.test2 import var2
print("test1")
print(var1)
print(var2)
version: "3"
services:
python:
container_name: python-restart-test
build:
context: .
command: nodemon app.py
working_dir: /app
volumes:
- ./:/app/
FROM nikolaik/python-nodejs:latest
RUN npm install -g nodemon
# Full path: inc/test1.py
var2 = 'testvar2'
# Full path: inc/test2.py
var1 = 'testvar1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment