0

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

1 Answers1

1

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()
anthonyjdella
  • 481
  • 2
  • 16
  • Thank you,to add on my question i want the server to expose my Downloaded folder to twillio ,so this automatically starts the server ,how can it also expose the downloads folder at the same time – Nkosi Ncube Dec 01 '22 at 15:48
  • Yea you can do this, I would recommend searching SO for "serve directory in python". There are some good answers out there, like this [one](https://stackoverflow.com/a/52531444/9465781). Hope that helps! – anthonyjdella Dec 01 '22 at 17:46