Django app deployment crashes due to cffi and libffi
Trying to deploy a Django app to Railway.
After it builds successfully the deployment crashes with this error:
#10 378.9 Running setup.py install for cffi: started
#10 378.9 Running setup.py install for cffi: finished with status 'error'
#10 378.9 error: subprocess-exited-with-error
#10 378.9
#10 378.9 × Running setup.py install for cffi did not run successfully.
#10 378.9 │ exit code: 1
#10 378.9 ╰─> [60 lines of output]
#10 378.9 Package libffi was not found in the pkg-config search path.
#10 378.9 Perhaps you should add the directory containing
libffi.pc'
#10 378.9 to the PKG_CONFIG_PATH environment variable
#10 378.9 No package 'libffi' found`69 Replies
Project ID:
4ad98339-d4b3-47d9-973d-7162b5b5fd9f
4ad98339-d4b3-47d9-973d-7162b5b5fd9f
please provide full build logs
https://bookmarklets.up.railway.app/log-downloader/
cool tool brody
thamks
there was attempt as well.
mysqlclient is in the requirements.txt
it wants
MySQLdb
thoughthanks that fixed that one
what about the cffi error in this log?
send your railway.json please
give this a try
still not working
send your requirements.txt please
does your project use every one of those modules?
probably not
please remove everything you are not using, let me know when thats done
kk
one second sorry
I have a question actually. Why is it still installing packages on an old version of requirements? I have changed the requirements.txt file so it shouldn't be doing that right?
does the repo have the correct requirements.txt in it?
yep
anyway. it's somewhat working now. I think there's an issue with my database, as I can't run it locally after some changes
will have to fix that first
build logs are fine, but deploy logs get stuck on accessing database
will get back to you
thanks so far
do you use a railway hosted database?
yeah
postgres
can i see a screenshot of your service variables please
what's that?
the variables for the railway service
sorry thats not what i asked for
these ones?
that is a plugin
i asked for the service variables
this one?
yes
you should be using a reference variable, please delete that variable and replace it with a reference variable
https://docs.railway.app/develop/variables#reference-variables
which one should i use for postgresql?
the same one you where already using, just this time its a reference
like this?
this way?
not at all
can you please read the docs sections i linked
?
can you please read the docs sections i linked
there we go
now please show me your code that connects to the database
you are still using sqlite
you will need to add the rest of the pstgres reference variables to your service and then configure your settings.py like this
https://github.com/railwayapp-templates/django/blob/main/mysite/settings.py#L81
looks fine at first glance
so it works, but there's an issue with my code
so its not working
if that makes sense
ahah
whats your start command
python3 manage.py migrate && python3 manage.py collectstatic --no-input && gunicorn readinghood.wsgi
also looks good
yeah its my code
i was using a mysql database
and it was working
it was using sqlite not mysql
yeah i changed to sqlite to use the mdn tutorial
doesnt seem to work using sqlite nor postgres
whats not working
will retry with mysql and get back to you
"django.db.utils.ProgrammingError: relation "book" does not exist
LINE 1: SELECT DISTINCT "book"."Category" FROM "book""
stay with postgres, mysql is costly
kk
just looks like a code issue to me tbh
it does too. but why was it working with mysql?
anyway
i'll have a look at the code after lunch
thanks man!
no problem