Heroku problem z wyświetleniem aplikacji

0

Dodałem skrypt python na heroku który lokalnie mi działał, a na heroku wyświetla się taki błąd:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
 Stopping process with SIGKILL
 Process exited with status 137
 State changed from starting to crashed
 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cardatageneration.herokuapp.com request_id=abee5670-08e0-4e21-97d8-1c65ea55beff fwd="89.64.73.139" dyno= connect= service= status=503 bytes= protocol=https
 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cardatageneration.herokuapp.com request_id=2a8bc471-76dc-4343-b1b3-f86e3059cc01 fwd="89.64.73.139" dyno= connect= service= status=503 bytes= protocol=https

Nie potrafię odczytać z tego co jest nie tak, pomoże mi ktoś znaleźć w czym leży problem?

0

A masz jakieś logi z aplikacji? Może np. zahardkodowałeś gdzies jakaś ścieżkę i aplikacja się wywala jak próbuje otworzyć plik z pulpitu? ;)

0

@Shalom:
"""
2021-10-06T1936.383707+00:00 app[web.1]: Connecting to the postgreSQL database ...
2021-10-06T1936.397163+00:00 app[web.1]: PostgreSQL database version:
2021-10-06T1936.399133+00:00 app[web.1]: relation "series" already exists
2021-10-06T1936.399133+00:00 app[web.1]:
2021-10-06T1936.399227+00:00 app[web.1]: Database connection terminated.
2021-10-06T1936.403598+00:00 app[web.1]: * Serving Flask app "main" (lazy loading)
2021-10-06T1936.403609+00:00 app[web.1]: * Environment: production
2021-10-06T1936.403634+00:00 app[web.1]: WARNING: This is a development server. Do not use it in a production deployment.
2021-10-06T1936.403651+00:00 app[web.1]: Use a production WSGI server instead.
2021-10-06T1936.403671+00:00 app[web.1]: * Debug mode: on
2021-10-06T1936.420924+00:00 app[web.1]: * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
2021-10-06T1936.423512+00:00 app[web.1]: * Restarting with stat
2021-10-06T1936.735739+00:00 app[web.1]: Connecting to the postgreSQL database ...
2021-10-06T1936.752414+00:00 app[web.1]: PostgreSQL database version:
2021-10-06T1936.754587+00:00 app[web.1]: relation "series" already exists
2021-10-06T1936.754587+00:00 app[web.1]:
2021-10-06T1936.754689+00:00 app[web.1]: Database connection terminated.
2021-10-06T1936.772605+00:00 app[web.1]: * Debugger is active!
2021-10-06T1936.772913+00:00 app[web.1]: * Debugger PIN: 136-872-010
2021-10-06T1935.161883+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-10-06T1935.220551+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-10-06T1935.419509+00:00 heroku[web.1]: Process exited with status 137
2021-10-06T1935.547902+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-06T2237.003245+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-06T2240.537223+00:00 heroku[web.1]: Starting process with command python main.py
2021-10-06T2242.546749+00:00 app[web.1]: Connecting to the postgreSQL database ...
2021-10-06T2242.569778+00:00 app[web.1]: PostgreSQL database version:
2021-10-06T2242.573279+00:00 app[web.1]: relation "series" already exists
2021-10-06T2242.573284+00:00 app[web.1]:
2021-10-06T2242.573441+00:00 app[web.1]: Database connection terminated.
2021-10-06T2242.580762+00:00 app[web.1]: * Serving Flask app "main" (lazy loading)
2021-10-06T2242.580776+00:00 app[web.1]: * Environment: production
2021-10-06T2242.580810+00:00 app[web.1]: WARNING: This is a development server. Do not use it in a production deployment.
2021-10-06T2242.580819+00:00 app[web.1]: Use a production WSGI server instead.
2021-10-06T2242.580832+00:00 app[web.1]: * Debug mode: on
2021-10-06T2242.598421+00:00 app[web.1]: * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
2021-10-06T2242.601095+00:00 app[web.1]: * Restarting with stat
2021-10-06T2242.950161+00:00 app[web.1]: Connecting to the postgreSQL database ...
2021-10-06T2242.963402+00:00 app[web.1]: PostgreSQL database version:
2021-10-06T2242.966357+00:00 app[web.1]: relation "series" already exists
2021-10-06T2242.966361+00:00 app[web.1]:
2021-10-06T2242.966469+00:00 app[web.1]: Database connection terminated.
2021-10-06T2242.991581+00:00 app[web.1]: * Debugger is active!
2021-10-06T2242.991911+00:00 app[web.1]: * Debugger PIN: 115-887-248
2021-10-06T2240.685821+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-10-06T2240.843471+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-10-06T2241.031055+00:00 heroku[web.1]: Process exited with status 137
2021-10-06T2241.068263+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-07T0412.827188+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-07T0416.219308+00:00 heroku[web.1]: Starting process with command python main.py
2021-10-07T0418.197122+00:00 app[web.1]: Connecting to the postgreSQL database ...
2021-10-07T0418.213420+00:00 app[web.1]: PostgreSQL database version:
2021-10-07T0418.215540+00:00 app[web.1]: relation "series" already exists
2021-10-07T0418.215541+00:00 app[web.1]:
2021-10-07T0418.215675+00:00 app[web.1]: Database connection terminated.
2021-10-07T0418.222964+00:00 app[web.1]: * Serving Flask app "main" (lazy loading)
2021-10-07T0418.222987+00:00 app[web.1]: * Environment: production
2021-10-07T0418.223023+00:00 app[web.1]: WARNING: This is a development server. Do not use it in a production deployment.
2021-10-07T0418.223050+00:00 app[web.1]: Use a production WSGI server instead.
2021-10-07T0418.223071+00:00 app[web.1]: * Debug mode: on
2021-10-07T0418.250709+00:00 app[web.1]: * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
2021-10-07T0418.254936+00:00 app[web.1]: * Restarting with stat
2021-10-07T0418.599206+00:00 app[web.1]: Connecting to the postgreSQL database ...
2021-10-07T0418.615285+00:00 app[web.1]: PostgreSQL database version:
2021-10-07T0418.617673+00:00 app[web.1]: relation "series" already exists
2021-10-07T0418.617697+00:00 app[web.1]:
2021-10-07T0418.617873+00:00 app[web.1]: Database connection terminated.
2021-10-07T0418.638801+00:00 app[web.1]: * Debugger is active!
2021-10-07T0418.639265+00:00 app[web.1]: * Debugger PIN: 167-224-437
2021-10-07T0416.657156+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-10-07T0416.766081+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-10-07T0416.935210+00:00 heroku[web.1]: Process exited with status 137
2021-10-07T0417.000864+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-07T1033.875789+00:00 heroku[web.1]: State changed from crashed to starting
2021-10-07T1037.308920+00:00 heroku[web.1]: Starting process with command python main.py
2021-10-07T1039.316493+00:00 app[web.1]: Connecting to the postgreSQL database ...
2021-10-07T1039.333287+00:00 app[web.1]: PostgreSQL database version:
2021-10-07T1039.339311+00:00 app[web.1]: relation "series" already exists
2021-10-07T1039.339319+00:00 app[web.1]:
2021-10-07T1039.339438+00:00 app[web.1]: Database connection terminated.
2021-10-07T1039.345049+00:00 app[web.1]: * Serving Flask app "main" (lazy loading)
2021-10-07T1039.345063+00:00 app[web.1]: * Environment: production
2021-10-07T1039.345105+00:00 app[web.1]: WARNING: This is a development server. Do not use it in a production deployment.
2021-10-07T1039.345120+00:00 app[web.1]: Use a production WSGI server instead.
2021-10-07T1039.345138+00:00 app[web.1]: * Debug mode: on
2021-10-07T1039.363579+00:00 app[web.1]: * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
2021-10-07T1039.366390+00:00 app[web.1]: * Restarting with stat
2021-10-07T1039.716810+00:00 app[web.1]: Connecting to the postgreSQL database ...
2021-10-07T1039.731429+00:00 app[web.1]: PostgreSQL database version:
2021-10-07T1039.734412+00:00 app[web.1]: relation "series" already exists
2021-10-07T1039.734417+00:00 app[web.1]:
2021-10-07T1039.734576+00:00 app[web.1]: Database connection terminated.
2021-10-07T1039.758436+00:00 app[web.1]: * Debugger is active!
2021-10-07T1039.758805+00:00 app[web.1]: * Debugger PIN: 212-697-226
2021-10-07T1037.703508+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-10-07T1037.765693+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-10-07T1037.905562+00:00 heroku[web.1]: Process exited with status 137
2021-10-07T1038.018866+00:00 heroku[web.1]: State changed from starting to crashed
2021-10-07T1130.131145+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cardatageneration.herokuapp.com request_id=2ba34cfd-7e76-4a99-a004-ae1e60abfb7b fwd="89.64.73.139" dyno= connect= service= status=503 bytes= protocol=https
2021-10-07T1130.803229+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=cardatageneration.herokuapp.com request_id=14a4fe64-53e3-42c8-b67f-dd4363f572aa fwd="89.64.73.139" dyno= connect= service= status=503 bytes= protocol=https
""
Tam często jest napisane, że "series already exists", ale wydaje mi się, że to nie powinno powodować problemów ponieważ lokalnie też dostawałem takie powiadomienia, a dalsza część skryptu nadal wyświetlała dane.

0

A jesteś pewien ze w heroku też ustawiłeś że ta apka wystartuje na porcie 5000?

0

@Shalom:
W sumie to na heroku nie ustawiałem żadnego portu, sprawdzę to dzięki

0

Google sugeruje że nie możesz wybrać portu, a to heroku ustawia ci zmienną środowiskową $PORT na który masz się bindować, więc w swojej apce musisz ustawić zeby na takim porcie startować a nie na domyślnym 5000

0

https://stackoverflow.com/a/27899874
Proponują w Pytongu:

import os
ON_HEROKU = os.environ.get('ON_HEROKU')

if ON_HEROKU:
    # get the heroku port
    port = int(os.environ.get('PORT', 17995))  # as per OP comments default is 17995
else:
    port = 3000
0

Zmieniając Procfile i dodająć "-p $PORT" pokazywało, że startuje appkę i był dopisek portu więc myślałem, że będzie ok, ale później dalej uruchamiało się na 5000.

Chciałem sprawdzić drugą metodę, ale nagle dyno information jest na off i wywala inny błąd. Poczekam, aż to się uruchomi znowu chociaż nie wiem dlaczego to się randomowo włącza i wyłącza. Jak sprawdzę to napiszę czy są jakieś postępy

1

Chciałem sprawdzić drugą metodę, ale nagle dyno information jest na off i wywala inny błąd. Poczekam, aż to się uruchomi znowu chociaż nie wiem dlaczego to się randomowo włącza i wyłącza. Jak sprawdzę to napiszę czy są jakieś postępy

Jeżeli dobrze pamiętam to na darmowej wersji heroku jeżeli aplikacja przez 30 minut nie ma ruchu sieciowego to się wyłącza. Polecam mieć to na uwadze, jeśli zamierzasz trzymać coś w pamięci a nie w bazie

0

@Burdzi0:
Podpowiesz mi jak to działa, albo kiedy dyno włącza się na heroku? Od ostatniej wiadomości czekam na włączenie się tego, a ciągle jest "off" i nie mogę sprawdzić czy moja apka działa bo wywala mi błąd spowodowany tym, że to jest wyłączone

1 użytkowników online, w tym zalogowanych: 0, gości: 1