R
Railway

✋|help

AttributeError: 'DatabaseWrapper' object has no attribute 'set_schema'

Mmidhun.19/9/2023
I'm using django with mutlitenants using the package django-tenants==3.5.0
When i deployed the app to railway im getting the error.

AttributeError: 'DatabaseWrapper' object has no attribute 'set_schema'

I have also updated the railway environment variables and set my engine to ... ENGINE=django_tenants.postgresql_backend
But I'm not able to fix the error
Mmidhun.19/9/2023
fd0bd18d-392d-4b0d-af5c-395356468583
BBrody9/9/2023
what version of python are you using locally and what version is railway using?
Mmidhun.19/9/2023
its python 3.10 in local
i dont know if there is any specfic python version in railway
BBrody9/9/2023
of course there is lol
check the build table at the top of the build logs
Mmidhun.19/9/2023
Mmidhun.19/9/2023
its python 3.8
Mmidhun.19/9/2023
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"nixpacksPlan": {
"providers": [
"python"
],
"phases": {
"setup": {
"nixPkgs": [
"...",
"nodejs"
]
}
}
},
"buildCommand": "npm ci"
},
"deploy": {
"startCommand": "pip install -r requirements.txt && python manage.py migrate && python manage.py collectstatic --noinput && gunicorn hospital_site.wsgi",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
this is my railway.json so how to modify it
BBrody9/9/2023
please read this section of the docs
https://nixpacks.com/docs/providers/python#setup
Mmidhun.19/9/2023
NIXPACKS_PYTHON_VERSION 3.10

i just need to add this environment variable ?
Mmidhun.19/9/2023
BBrody9/9/2023
yep if that's the method you'd like to use
Mmidhun.19/9/2023
ok let me see this if this would fix the issue hopefully 🙂
im still getting the issue, I think the problem is not related to the python version. Could it be something else
BBrody9/9/2023
are you using alll the same dependency versions locally and on railway?
Mmidhun.19/9/2023
yes. I have added the version in requirements.txt
Mmidhun.19/9/2023
BBrody9/9/2023
right but that doesnt mean you are using those versions locally
Mmidhun.19/9/2023
I have checked again the requirements. This issue with database started coming only when i implemented multi tenancy in django app
BBrody9/9/2023
then this is just sounding like a code issue
this issue wouldnt be exclusive to railway, please research this issue
Mmidhun.19/9/2023
but this error doesnt happen in both of my local systems but only in production.
BBrody9/9/2023
unfortunately that doesn't rule out a code issue
railway runs your code as is after all
Mmidhun.19/9/2023
ENGINE=django_tenants.postgresql_backend

I have set my engine like this in my environment varibles. My doubt is that could there be a problem with setting engine like this in railway
Mmidhun.19/9/2023
Bro I'm still facing the issue 😢 from what i googled I cant find a solution for this. Usually this error happends when we are not using postgres. But my code looks fine and I have tried connecting with differnt dbs in local and it works fine. its crashing only in prod. Is there anything to do with the railway.json file ?
BBrody9/9/2023
^
Mmidhun.19/9/2023
yea I have set like this and pushed my code. But didnt work
BBrody9/9/2023
please reference this working template
https://github.com/railwayapp-templates/django
Mmidhun.19/9/2023
Thanks very much Brody you are literally god sent. I messed up the variables that I had set in the railway. It had nothing to do with the python version. Cheers thank you very much once again
https://tenor.com/view/thank-you-sticker-thanks-sticker-line-sticker-bear-sticker-bear-gif-26476682
BBrody9/9/2023
🥳🥳

Looking for more? Join the community!

Recommended Posts
Hosting errori am hosting my discord bot written in python using nextcord library and when i deploy it then it shDeploy angular applicationerror: ```2 minutes ago via GitHub Init main View Logs Removed Deployed 3 minutes ago vimongo on railwayI am trying to get mongo v7 up and running on railway. When using default options, I am getting follTCP Proxy timeoutI'm trying to start a Redis server with the official Docker image from Docker Hub with #TCP + LogginHow to move from Working Localhost w/ Django Websockets to Railway production?I had a functioning django websocket fantasy draft on my local host using daphne and redis. However,There's suddenly two new random columns in my database??I went in and checked my railway dashboard and to my surprise there's two new completely random dataRailway having issues with Mongoose NPM package???Locally my code works fine, I can connect to Mongo using Mongoose no issues but when on Railway it rNo VAT taxes on invoicesHello everyone I've just joined this server. On my invoices, I don't see any VAT tax prices includeIssue with mounting volumeHello, I have an instance of n8n running, I need to attach a volume to keep community node persistenPin memory usageI'm running a service that scales memory usage unpredictably and quickly, and it crashes in these caVariables redeploy infoSometimes when I don't have an active deployment and I change the variables it triggers a redeploy bStatic IPsIs there any updates for static IPs? I would love to use Railway for a Discord bot so everything is Prebuilt Mqtt Service and PortsLooking for some guidance. Currently have a couple different services in my project, including a posMySQL queries timeout or lead to blank screen on web versionFor the last 2 days or so I've been running into some problems with my personal project database. ItAdonisjs Migration - MySQL using password noTrying to deploy an app on railway with adonisjs and a MySQL database, I can get the web app runningGraalVMHi, is it possible to build a graalvm image in nixpacks? https://github.com/railwayapp/nixpacks/issuDebugging issuesIs their someway to get into filesystem so I can debug production errors a0aaa94d-45ad-410c-bcae-31Debugging issuesIs their somehow to get into file system? or the built filesEnabled mlockHi everyone, I'm currently creating a template for the hashicorp vault service (https://developer.hSubscription already existsI can't enable the developer plan, the system returns the message: "Subscription already exists"