R

Railway

βœ‹ο½œhelp

Join Server

Flask app not running on the Railway domain

RRuu3f5/24/2023
I know it can be the problem that I am bad at coding, but asking for help is a thing soo....

Error:
* Serving Flask app 'main'
* Debug mode: off
Name or service not known

Code used to run the app:
app.run(host="0.0.0.0:$PORT")
RRuu3f5/24/2023
1110989921826656306
Bbrody5/24/2023
do you have a repo i could look at?
RRuu3f5/24/2023
yes i do.
RRuu3f5/24/2023
may i send you the files in DMs?
Bbrody5/24/2023
no thank you
RRuu3f5/24/2023
okay then?
Bbrody5/24/2023
please send a link to your repo here
RRuu3f5/24/2023
okay, its private though. Let me make it public
RRuu3f5/24/2023
thank you by the way.
Bbrody5/24/2023
im sorry but this repo breaks railways tos, twice.
freeGPT, duckduckgo-search
Bbrody5/24/2023
both of these packages scrape data from the service unofficially
RRuu3f5/24/2023
okay
RRuu3f5/24/2023
i tried using duckduckgo's official JSON API but it did not work quite well
Bbrody5/24/2023
duckduck go no longer has an offical json api afaik
Bbrody5/24/2023
one sec tho, i will provide alternatives for you
Bbrody5/24/2023
thats not a full search api btw
RRuu3f5/24/2023
Yeah, that was the problem and I switched to duckduckgo-search
RRuu3f5/24/2023
wait, are online APIs allowed?
Bbrody5/24/2023
use this flask template
https://github.com/railwayapp-templates/flask
for search, google has a full search api, and they have a python package to use it
https://developers.google.com/custom-search/v1/introduction
for chatgpt, use openai's official package
https://pypi.org/project/openai/
Bbrody5/24/2023
explain what you mean by online
RRuu3f5/24/2023
but openai's official package is not free 😦
RRuu3f5/24/2023
btw thanks a lot for your time and advice!
Bbrody5/24/2023
correct it is not entirely free, you do get 5$ from them though
Bbrody5/24/2023
but yeah you need to be using official apis for the services you are using, both those packages do not use official apis
RRuu3f5/24/2023
can I use alternative APIs that give GPT for free?
RRuu3f5/24/2023
as a normal discord guy, i'm broke πŸ’€
Bbrody5/24/2023
absolutely not, that would break both openai's tos and thus railway's tos
Bbrody5/24/2023
you need to be using official apis, with your own api keys
RRuu3f5/24/2023
okay fine i guess
Bbrody5/24/2023
anything else is a big no no, and ive seen that it could result in a ban from railway
RRuu3f5/24/2023
hey but you did not give me a fix to this problem 😦
Bbrody5/24/2023
yes i did
Bbrody5/24/2023
^
RRuu3f5/24/2023
i used the flask template
RRuu3f5/24/2023
from railway
Bbrody5/24/2023
no you didnt
RRuu3f5/24/2023
hmm wait
RRuu3f5/24/2023
oh yeah, i did now
Bbrody5/24/2023
can i have some reassurance that you will stop using those two packages, i really dont want you to randomly have your account banned
RRuu3f5/24/2023
i will not use both of those.
Bbrody5/24/2023
and you understand why you cant use packages like those?
RRuu3f5/24/2023
yeah, railway does not allow them
RRuu3f5/24/2023
since they are not original
RRuu3f5/24/2023
i understand.
Bbrody5/24/2023
perfect, thank you so much for understanding
RRuu3f5/24/2023
i will change them, just let me try and run the flask app
RRuu3f5/24/2023
if it works now
Bbrody5/24/2023
you can fork railway's flask app then use that as a starting point
RRuu3f5/24/2023
yeah, i started from it and then.. got lost
RRuu3f5/24/2023
now i fixed my code, it should work
RRuu3f5/24/2023
thank you for your time and assistance btw
Bbrody5/24/2023
happy to help
RRuu3f5/24/2023
RRuu3f5/24/2023
its not even giving me a error now
Bbrody5/24/2023
can i see your repo that you deployed that from?
RRuu3f5/24/2023
nevermind, i found the error
RRuu3f5/24/2023
Looks like your app is listening on 127.0.0.1. You may need to listen on 0.0.0.0 instead. yeah this
Bbrody5/24/2023
you must not be using gunicorn
RRuu3f5/24/2023
what is that, i've not even heard about it
Bbrody5/24/2023
please use the railway flask template
RRuu3f5/24/2023
yeah.... i am using it ;-;
Bbrody5/24/2023
you are not
RRuu3f5/24/2023
the repository is still public, may you please check it?
Bbrody5/24/2023
send it
Bbrody5/24/2023
this is not a fork of the railway flask template
Bbrody5/24/2023
and it still uses those two packages
RRuu3f5/24/2023
yeah, i will remove those two later
RRuu3f5/24/2023
I used the 'Flask' template when making my railway app
RRuu3f5/24/2023
and then i added my code
RRuu3f5/24/2023
to it
Bbrody5/24/2023
lets start fresh with forking the railway flask template please, we dont want to continue using this repo
RRuu3f5/24/2023
okay.
RRuu3f5/24/2023
give me a minute.
RRuu3f5/24/2023
Okay, i deleted the repository and created a new one with the original flask template: https://github.com/ruu3f-studio/RSearchX
Bbrody5/24/2023
perfect!
Bbrody5/24/2023
that will work on railway
RRuu3f5/24/2023
okay, so i will start adding my code without those two libraries
RRuu3f5/24/2023
thanks!
Bbrody5/24/2023
keep the routes at the root level, before you had them in a function
Bbrody5/24/2023
and dont touch the procfile
RRuu3f5/24/2023
yeah, i wont
Bbrody5/24/2023
perfect, and you can use those two alternatives i linked to achieve the same functionality as your old app had, just this time it wont break tos πŸ™‚
RRuu3f5/24/2023
thanks!
Bbrody5/24/2023
no problem, if you run into any troubles with railway feel free to come ask
RRuu3f5/24/2023
okay.