R
Railway11mo ago
Renzo

I can't get my project to run correctly, crashed.

After loading almost completely, and being in green, the project simply crashes and the service is not available at any time, I tried several things with my docker file, but none of this solved it. 4de4b796-fa65-4a2f-9c38-187fd073fed7
No description
Solution:
then line 15 of your dockerfile should be
CMD gunicorn copy:app
CMD gunicorn copy:app
...
Jump to solution
40 Replies
Percy
Percy11mo ago
Project ID: 4de4b796-fa65-4a2f-9c38-187fd073fed7
Brody
Brody11mo ago
please share your repo
Renzo
RenzoOP11mo ago
4de4b796-fa65-4a2f-9c38-187fd073fed7 This?
Brody
Brody11mo ago
thats a project id, but id like you to share your github repo if possible, it would speed debugging up
Renzo
RenzoOP11mo ago
No description
No description
No description
Renzo
RenzoOP11mo ago
thats all
Brody
Brody11mo ago
some of the issues i see - this is a flask app, but you are trying to use uvicorn - you are copying in your requirements.txt file but aren't installing the packages in it - you may be missing some packages in your requirements.txt file - you are scraping Instagram, scraping is a big grey area on railway and is even listed in their tos
Renzo
RenzoOP11mo ago
If I am installing the requirements, and I review it, I think I am not missing anything Regarding flask app, how should I use it? What I found on the internet about how to run a test for this is what I put in the code And regarding the terms of service, I am running a selenium test and I use my own resources
Brody
Brody11mo ago
it doesnt matter, you are running the service on railway, but im not going to police you on that, so just know people have been banned for less. maybe look into using Instagram's api? unless im blind (its possible) i dont see the line in your dockerfile to install from the requirements.txt file you want to use gunicorn
Renzo
RenzoOP11mo ago
On line 11 pip install -r requirements.txt, that doesn't work?
Brody
Brody11mo ago
see, told you its possible that im blind okay then back to my first point, line 15 of your dockerfile, you are trying to start you app with uvicorn, you need to be using gunicorn instead
Renzo
RenzoOP11mo ago
I'm confused, I thought it was the same
Brody
Brody11mo ago
uvicorn is not the same as gunicorn for flask, you want gunicorn
Renzo
RenzoOP11mo ago
Then I would have to find a way to change the command on line 15 where gunicorn runs.
Brody
Brody11mo ago
just change it? with your text editor of choice, you can even edit the file in github itself
CMD gunicorn app:app
CMD gunicorn app:app
Renzo
RenzoOP11mo ago
And the syntax is the same? that's what I mean
Brody
Brody11mo ago
yeah just how i wrote it, theres no need to overthink this
Renzo
RenzoOP11mo ago
Now it seems that if I load the module, but after trying the same thing several times it always gives the error ModuleNotFoundError: No module named 'app'
Renzo
RenzoOP11mo ago
No description
Renzo
RenzoOP11mo ago
I am always amazed, on my localhost everything always works, when I deploy something always fails hahaha
Brody
Brody11mo ago
do you have an app.py or a main.py?
Renzo
RenzoOP11mo ago
No, my file has another name, should it have one of those?
Brody
Brody11mo ago
what is your file name
Renzo
RenzoOP11mo ago
original copy.py I thought that doesn't affect anything, actually a newbie here
Brody
Brody11mo ago
this is the copy.py file?
No description
Renzo
RenzoOP11mo ago
Yes, it is the only .py file
Brody
Brody11mo ago
as someone who has helped thousands of people here, running locally is always going to be easier than running in a production environment
Solution
Brody
Brody11mo ago
then line 15 of your dockerfile should be
CMD gunicorn copy:app
CMD gunicorn copy:app
Renzo
RenzoOP11mo ago
And my .py file should be called app.py?
Brody
Brody11mo ago
no? the app part of that is referring to line 9 of your copy.py file
Renzo
RenzoOP11mo ago
ok
Brody
Brody11mo ago
let me know how this goes
Renzo
RenzoOP11mo ago
It works perfectly, thank you very much. I'm new to all this and people like you help a lot!
Brody
Brody11mo ago
happy to help!
Renzo
RenzoOP11mo ago
Out of curiosity, how many years of experience do you have?
Brody
Brody11mo ago
with python? none, im not a python dev
Renzo
RenzoOP11mo ago
I mean this whole world
Brody
Brody11mo ago
uh maybe 4-5 years in tech stuff
Renzo
RenzoOP11mo ago
That's a lot! Have a good night, greetings!
Brody
Brody11mo ago
have a good/day night as well!
Want results from more Discord servers?
Add your server