Some python files print while others don't

Problem:
My main.py wont print into the console and i’m using the django template. Only whatevers in the django template is printed but i dont need any of that to be printed i just need main.py to be printed.
Repl link:
https://replit.com/@TrvstDerek/DisBot?v=1

And by the way all of main.py is correct and fully functional, it just wont print into the console because of the django template and i have no idea why.

What are you using django for? Could you use a blank repl?

I’m using django for uptimerobot so the repl doesn’t go down. I’ve used flask but I think django is better than flask.

The .replit config on the django template makes it run manage.py instead of main.py. Just use a normal python repl. For keep-alive you can use a minimal webserver: at the start of your code:

from http import server
import multiprocessing

class Server(server.BaseHTTPRequestHandler):
    # Override the log_request function to prevent spammy logging output
    def log_request(_, __):
        pass

    def do_HEAD(self):
        self.send_response(204)
        self.end_headers()
    
    do_GET = do_HEAD 

multiprocessing.Process(
    target=server.ThreadingHTTPServer(("", 80), Server).serve_forever
).start()
1 Like

Oh alright, that works too. Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.