Forums

Task stuck in 'starting'

I have my main app.py with this code

#pages & receive webhook

#home page html
@app.route('/')
def welcome():
    return render_template('index.html')

#webhook
@app.route('/webhook', methods=['POST'])
def webhook():
    # print(request.data)
    data = json.loads(request.data)

when I run this the index.html renders so I know that part works

I am sending json code in a webhook from trading view to /webhook

I am running the main page as a always on task in the tasks tab with this command

python /home/usern/mysite/app.py

this is the correct directory

The webhook is triggered in tradingview but my app.py does not trigger and the alway on task is permanently in 'starting' mode

How can I get the task to receive the webhook and trigger my app?

You cannot use an always on task to run a web application. Use a web app to run your web application.

I don't understand what you mean, I'm very new to coding

just to clarify the rest of the code in my app.py file is a trading bot that will run buy and sell functions. The webhook sends data to the app to fill out the functions.

essentially I need to run a task that listens for the webhook and then triggers my app to run.

can you point me to a tutorial

To set up your web app, you can follow the instructions on this help page: https://help.pythonanywhere.com/pages/WebAppBasics/

thanks I understand and have built that now, no need for always on tasks.