Forums

Django Postgres Relationship does not exist

Hi Team ... here my setup 1. Django 2. Postgres 3. I can access postgres database from console 4. Django settings double checked ... looks fine 5. I can migrate into database.schema ... checked via console ... tables have been migrated to schema. 6. I CREATE-ed the database and its schema from the postgres console 7. Note I'm using db-multitenant module ... isolated schema per tenant.

However when i go to my site via browser I get Django errors that relationships do not exist.

Please help?!

Did you do migrations using Django management commands?

yes ... also as per db-multitenant module requirement ... TENANT_NAME=example-schema ./manage.py 'command'. I also tested now 'postgres' database ... gave same error so I guess the issue is not with postgres or connection ... [?]

I now found this old post :

If u want to have infinite number of x.yourdomain.com and y.yourdomain.com etc, PythonAnywhere doesn't support that right now.

Staff conrad | 4191 posts | PythonAnywhere staff | Dec. 5, 2016, 9:30 a.m. | permalink

... is this still the case? PA does not support demo.example.com [subdomain] site requirement? Its not clear in the setup docs.

Is your first issue solved, or do you need some more assistance?

Regarding the question about subdomains -- each subdomain have to be a separate web app on PythonAnywhere.

Nope ... still can't get the app to 'see' the database during access via browser. I have rechecked and built the virtualenv ... redone database and schemas ... re-setup postgres ... with no luck. Its probably something simple that I'm missing. Keeping in mind that the migrations have been made to db.custom-schema and not to db.public ... does the postgres database address point to db.public only?

However, it may be that I can't use PA anyway. Creating a separate web app for each subdomain sort of takes away the benefit of using pg schemas for each tenant right? Its like having a separate deployment with each subdomain [tenant] accompanied by individual software updates and DB management. Or does PA have an elegant solution for this challenge? Note that I'll probably end up with around 40 tenants max ... at most each with around 150 users on average.

I'm not familiar with the software you're using, but generally yes -- you'd need to have multiple web apps to support subdomains; and those web apps could have access to the same database. Regarding your original issue -- what do you mean by 'access via browser'? Do you have queries in JavaScript code?

My apologies ... when i type www.softservemedia.com into browser ... keeping in mind settings.py set as DEBUG=True ... I get Django debug page "relationships don't exist" even though I can clearly see postgres console that all tables were migrated well.

Ok ... thank you for your assistance ... seems clear from what you say that we can't use PA for SAAS setup using subdomains ... i shall then request payment reimbursement.

Please contact us via support@pythonanywhere.com so we can continue there.