R
Railway

✋|help

Django app deployment crashes due to cffi and libffi

Llionel66519/6/2023
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 containinglibffi.pc'
#10 378.9 to the PKG_CONFIG_PATH environment variable
#10 378.9 No package 'libffi' found`
Llionel66519/6/2023
4ad98339-d4b3-47d9-973d-7162b5b5fd9f
Bbrody1929/6/2023
Tthallescomh9/6/2023
cool tool brody
Bbrody1929/6/2023
thamks
Llionel66519/7/2023
Llionel66519/7/2023
there was attempt as well.
Llionel66519/7/2023
Llionel66519/7/2023
mysqlclient is in the requirements.txt
Bbrody1929/7/2023
it wants MySQLdb though
Llionel66519/11/2023
thanks that fixed that one
what about the cffi error in this log?
Llionel66519/11/2023
Bbrody1929/11/2023
send your railway.json please
Llionel66519/11/2023
Bbrody1929/11/2023
give this a try
{
  "$schema": "https://schema.up.railway.app/railway.schema.json",
  "build": {
    "builder": "NIXPACKS",
    "nixpacksPlan": {
      "providers": ["python"],
      "phases": {
        "setup": {
          "nixPkgs": ["...", "nodejs", "libffi"]
        },
        "ci": {
          "dependsOn": ["setup"],
          "cmds": ["npm ci"]
        }
      }
    }
  },
  "deploy": {
    "numReplicas": 1,
    "startCommand": "python3 manage.py migrate && python3 manage.py collectstatic --no-input && gunicorn readinghood.wsgi",
    "restartPolicyType": "ON_FAILURE",
    "restartPolicyMaxRetries": 10
  }
}
Llionel66519/11/2023
Llionel66519/11/2023
still not working
Bbrody1929/11/2023
send your requirements.txt please
Llionel66519/12/2023
Bbrody1929/12/2023
does your project use every one of those modules?
Llionel66519/12/2023
probably not
Bbrody1929/12/2023
please remove everything you are not using, let me know when thats done
Llionel66519/12/2023
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?
Bbrody1929/12/2023
does the repo have the correct requirements.txt in it?
Llionel66519/12/2023
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
Bbrody1929/12/2023
do you use a railway hosted database?
Llionel66519/12/2023
yeah
postgres
Bbrody1929/12/2023
can i see a screenshot of your service variables please
Llionel66519/12/2023
what's that?
Bbrody1929/12/2023
the variables for the railway service
Llionel66519/12/2023
Bbrody1929/12/2023
sorry thats not what i asked for
Llionel66519/12/2023
these ones?
Bbrody1929/12/2023
that is a plugin
i asked for the service variables
Llionel66519/12/2023
Llionel66519/12/2023
this one?
Bbrody1929/12/2023
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
Llionel66519/12/2023
Llionel66519/12/2023
which one should i use for postgresql?
Bbrody1929/12/2023
the same one you where already using, just this time its a reference
Llionel66519/12/2023
like this?
Llionel66519/12/2023
Llionel66519/12/2023
this way?
Bbrody1929/12/2023
not at all
can you please read the docs sections i linked
Llionel66519/12/2023
Llionel66519/12/2023
?
Bbrody1929/12/2023
can you please read the docs sections i linked
Llionel66519/12/2023
Bbrody1929/12/2023
there we go
now please show me your code that connects to the database
Llionel66519/12/2023
Bbrody1929/12/2023
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
Llionel66519/12/2023
Bbrody1929/12/2023
looks fine at first glance
Llionel66519/12/2023
so it works, but there's an issue with my code
so its not working
if that makes sense
ahah
Bbrody1929/12/2023
whats your start command
Llionel66519/12/2023
python3 manage.py migrate && python3 manage.py collectstatic --no-input && gunicorn readinghood.wsgi
Bbrody1929/12/2023
also looks good
Llionel66519/12/2023
yeah its my code
i was using a mysql database
and it was working
Bbrody1929/12/2023
it was using sqlite not mysql
Llionel66519/12/2023
yeah i changed to sqlite to use the mdn tutorial
doesnt seem to work using sqlite nor postgres
Bbrody1929/12/2023
whats not working
Llionel66519/12/2023
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""
Bbrody1929/12/2023
stay with postgres, mysql is costly
Llionel66519/12/2023
kk
Llionel66519/12/2023
Bbrody1929/12/2023
just looks like a code issue to me tbh
Llionel66519/12/2023
it does too. but why was it working with mysql?
anyway
i'll have a look at the code after lunch
thanks man!
Bbrody1929/12/2023
no problem

Looking for more? Join the community!

Recommended Posts
My URL stopped workingHello, I installed typebot on my Railway server, then I updated my Tybebot subdomain: viewer-producMounting a volumeHi! is there a way to upload files to a volume or mount it on my local mahcine?Hello, i have a deploy error that i don't have beforeHello, my last deploy was a year ago, i have make a litle update and now the nodejs projet give my Issue with setting up custom domainHey guys I have an app hosted on railway. I've added a custom domain and based on the intructions I You have an unpaid invoice. You must pay this invoice before you can upgrade to the Hobby plan.I was trying to pay $20 for the Hobby plan, and then my card was declined, after a few second I got Anyone who has recently deployed a nodejs server on railway willing to help?My server runs fine locally, however when deployed its not listening to the requests. I put in the rIs there a way to auto restart a service to save memory? There an api available that we can trigger?I want to see if there is a way to restart my service in specified durations. if there's an api trigHow to using 3.0.0 dart version?``` #10 [6/9] RUN dart pub get #10 0.566 Resolving dependencies... #10 0.666 The current Dart Using AND in logs Search and fetching these via an APII want to use AND to search the logs with both the keywords, currently the logs search assumes OR whAccessing current Nixpacks fileI need to install Poppler on my Railway environment. From what I can see one way to do this is via tI am having trouble connecting to Azure Data Studio (Postgres)I am trying everything can't seem to connect to ADS any advice? This is the error I'm recieving ``API accusing Application failed to respond in development environmentI'm trying to run my application in the development environment, but it gives an error. It only runsAPI accusing Application failed to respond in development environmentI'm trying to run my application in the development environment, but it gives an error. It only runsRestore old logs?Hi! Is there a way to restore old log feature while you figure out the kinks in the new one? The newSource IPsIm sure I'm missing it in the documentation But is there a list of source IPs from railway deploymeError running the application in the background.I cannot or the screen -S command is not executed in my program, and I do not know what the solutionMedical System To ProductionHello, I am developing a medical system and I want to put it into production using Railway so that eDeploy restarted near the endJust deployed a change (573e8198-6981-45c6-81ae-91d5210afc0c) and it got through the build, then staFiles uploadGood afternoon, I would like to create a small SaaS application and deploy it entirely to railway. Upgrade To Hobby Plan:Why am I unable to upgrade to a Hobby Plan? Your UI keeps getting stuck on this page each time I try