44 Replies
Project ID:
N/A
service names have a character limit of 32, perhaps that's your issue?
oh yeah that's 46 characters
:S
can I even change the repo name right now? Im not sure
I'm sure you can, you can also just create a blank service and then connect your repo to it, then give the service a shorter name
Hold on I never deployed a FastAPI repo here, my first time using anything Python related
I found somewhere I gotta add this somewhere: uvicorn main:app --host 0.0.0.0 --port $PORT
correct, you would use that, adjusting the main:app part incase your entrypoint isn't named main
Oh I got this error on the logs: Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
(but it works 100% on local btw)
okey so it seems I need to create a requirements.txt, with the modules to be installed, is this correct?
you are correct again!
okey, will try that
@Brody Im not sure what Im doing wrong
Yeah I keep getting this, no idea what could it be: ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
Traceback (most recent call last):
File "main.py", line 1, in <module>
from fastapi import FastAPI
ModuleNotFoundError: No module named 'fastapi'
please no pings
i will look at your repo shortly
ah sorry for the pings
okey thank you
move the requirements.txt file into the app folder
ah gonna try that right now
I assume you have the root directory set to /app ?
mmm actually yes I think so
I got a huge long error, hold on
It somehow seems like it started doing the pip install requirements so at least Its showing that
Hold I will copy the entire Build Logs:
that's not the entire build logs
I think discord recognised message as too long and cut it for me
hold on I will put it into a .txt myself
There it is
I cant figure out the issue tbh
it doesnt look like you are using
mysqlclient
anywhere, try removing it from your req.txtI will try that later im going to eat some food brb
sounds good!
Just did and commited, but it crashed again, Im not sure about the mysql client and Im actually using a mysqldb, so it might make sense. Im not even sure what dependencies I installed tbh
you might wanna go through your requirements.txt and remove stuff you arent using
Im not even sure where most those requirements are even coming from
your system
you froze all your system packages into that requirements.txt file
ah
I wonder if theres a way to automatically detect what modules are being used
cause otherwise ima have to play guess since some of the modules are native I believe, some others are not... Im coming from JS development, where theres a package.json, feel kinda lost
either way Im using lets say, all those modules, and in local is not giving me any issues so Im not sure if it could be that the issue
thats python dependency management for you
but it should not crash either way assuming it just has more packages, if its working on my local, right? I understand it will take bit more of disk space but its just a demo for my CV I dont plan to do much more there
so in my opinion it would be okey if it had many many modules even if half or more unused
Im using Python 3.11 in local, do you know the version of Railway? Or how to update it? Maybe it could be that
3.8 by default
https://nixpacks.com/docs/providers/python#setup
ah, is it possible to update it?
please read the docs i linked
ah yes I see, with a .env
I will try that now
uh no??
where do you see mention of an .env file
The version can be overridden by
Setting the NIXPACKS_PYTHON_VERSION environment variable
I just tried anyways and no it doesnt work :/
not sure what else to try anymore tbh
move to postgres lol
but my hosting is on mysql
also it actually works, its a remote db
like I can do post, get etc operations on the FastAPI backend running in local but the remote database gets updated
I asked chatgpt for the dependencies after passing files by 1 and I got this: fastapi==0.100.0
passlib==1.7.4
PyJWT==2.7.0
pydantic==2.0.3
python-dotenv==1.0.0
SQLAlchemy==2.0.19
so im gonna try with that
okey, build didnt crash now at least
taking long to deploy now not sure if thats normal but lets see
I got this different error now on the build logs: Traceback (most recent call last):
File "/app/main.py", line 8, in <module>
from .db.dbconnect import engine, Base, SessionLocal
ImportError: attempted relative import with no known parent package
Traceback (most recent call last):
File "/app/main.py", line 8, in <module>
from .db.dbconnect import engine, Base, SessionLocal
ImportError: attempted relative import with no known parent package
Traceback (most recent call last):
File "/app/main.py", line 8, in <module>
from .db.dbconnect import engine, Base, SessionLocal
ImportError: attempted relative import with no known parent package
Traceback (most recent call last):
File "/app/main.py", line 8, in <module>
from .db.dbconnect import engine, Base, SessionLocal
ImportError: attempted relative import with no known parent package
Traceback (most recent call last):
File "/app/main.py", line 8, in <module>
from .db.dbconnect import engine, Base, SessionLocal
ImportError: attempted relative import with no known parent package
Traceback (most recent call last):
File "/app/main.py", line 8, in <module>
from .db.dbconnect import engine, Base, SessionLocal
ImportError: attempted relative import with no known parent package
Traceback (most recent call last):
File "/app/main.py", line 8, in <module>
from .db.dbconnect import engine, Base, SessionLocal
ImportError: attempted relative import with no known parent package
Traceback (most recent call last):
File "/app/main.py", line 8, in <module>
from .db.dbconnect import engine, Base, SessionLocal
ImportError: attempted relative import with no known parent package
Quick question: Railway might charge me usage over time for a proyect thats not deployed / crashed as it currently is?
no you wouldnt be charged for services that dont have a running deployment
ah okey, thanks
Instead of pip freeze you could try pipreqs https://pypi.org/project/pipreqs/ (sorry if this is useless for you)
Thank you but anyways I will just not deploy that one its just for adding to CV that I have done the project they can see the code anyways should be enough for my purpose, hopefully