R
Railwayβ€’13mo ago
Ruu3f

Flask app not running on the Railway domain

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