bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.45k stars 424 forks source link

Nginx - Dinamically? #624

Closed alxroots closed 4 years ago

alxroots commented 4 years ago

I am simulating a deployment in the VirtualBox, everything is going well but when I try setting up for multiple server_name, I get an error (it shows nginx welcome page). My NginX file configuration is like this: server { listen 80; server_name 192.168.1.123, *.192.168.1.123; location = /favico.ico {access_log off; log_not_found off;} location /static/ { root /home/myuser/myproject; } location / { include proxy_params; proxy_pass http://unix:/run/gunicorn.sock; } } Is this right? and if it is right it suppose create my new pages every time that I create a new tenant? In my local machine I have to go to /etc/hosts/ and manually allow each new tenant in this case (nginx) I don't need to do this? Sorry, it's quite beginner question, but I would like to learn that multi-tenancy architecture. Thank you all

alxroots commented 4 years ago

Well the first part of the question I have already solved, I was getting the error cause there was a coma between the servers name. it suppose to be: server_name 192.168.1.123 *192.168.1.123; #no comma

moojen commented 4 years ago

Did you restart Gunicorn? Anyway, it is very unlikely this is related to DTS, as you're seeing the Nginx welcome page, so it is highly unlikely that the request was passed to Django.

alxroots commented 4 years ago

@e-mojo Thx for your suggestion, yes I already restart Gunicorn, I have heard this is not working cause ip address has no subdomain, now I am trying to change the 192.168.1.123 to example.com and see if it will work, my problem is I am using virtual box (simulating a real server) and I am not sure how to change soon I will get news :)

alxroots commented 4 years ago

I solved my problem guys, my question and my solution is rigth here: https://github.com/tomturner/django-tenants/issues/327