Ask coding questions

← Back to all posts
running forever
azadkumar (0)

hello,
is there any way through which I can make my script run 24*7 without logging in to Replit.

Comments
hotnewtop
CosmicBear (56)

use a pinger such as https://ping.matdoes.dev.
Edit: so that is only for websites. Instead, make another file and insert this code:

from flask import Flask
from threading import Thread

app = Flask(__name__)

@app.route('/')
def home():
    return "hello world"

def run():
  app.run(host='0.0.0.0',port=8080)


def keep_alive():  
    t = Thread(target=run)
    t.start()

Then import the keep_alive function and run it before the rest of your code. Then, add the url to the pinger thingy.
Edit 2: it seems that you already have this in your code.

azadkumar (0)

@CosmicBear which url should i add to pinger

azadkumar (0)

@CosmicBear i am trying to run my code ,it does not even create any server it says repl is running at ip(localhost), please see if i have any changes to do with my code

FishballNooodle (213)

Hi please check my pinned repl named forever
For full instructions
I also have a series of discord bot tutorials

FloCal35 (671)

Replit has something called Always on repls, but it's a hacker feature. If you want it, you need to upgrade