Home > Blockchain >  How to automatically start a python http server
How to automatically start a python http server

Time:12-02

I am using python http.server 80 to expose my downloaded files to my twilio whatsapp bot is there a way that as my django-twillio app starts it automatically runs the server on port 80 as well python -m http.server 80

CodePudding user response:

Adding this code to your django-twilio app will programmatically start your server on localhost:80

from http.server import HTTPServer, SimpleHTTPRequestHandler

httpd = HTTPServer(('localhost', 80), SimpleHTTPRequestHandler)
httpd.serve_forever()
  • Related