djaoapp icon indicating copy to clipboard operation
djaoapp copied to clipboard

App is only accessable from localhost

Open markododa opened this issue 6 years ago • 1 comments

When i'm trying to open djaoapp started from python manage.py runserver 0.0.0.0:8000 via the lan ip address i get

`

Request Method: GET
http://10.0.10.59:8000/
djaoapp.views.product.ProxyPageView
'10.0.10.59' could not be found.
`
However if i open it from localhost everything works just fine.
Any idea what might be the issue?

markododa avatar Jul 20 '18 11:07 markododa

make install-conf will install 2 configuration files loaded by settings.py (these files should be in *VIRTUALENV/etc/djaoapp). site.conf by default declares DEBUG = False (aka Django production mode) which will make Django take into account ALLOWED_HOSTS. djaodjin-multitier middleware will also use ALLOWED_HOSTS to attempt to derive the multitier.Site model to use. This middleware is crafted such that instead of subdomains, we can use path prefixes that behaves like subdomains, a setup that makes it easier to test on a local dev machine.

To fix your problem, I recommend to add 10.0.10.59 as the first entry in ALLOWED_HOSTS.

ALLOWED_HOSTS = ('10.0.10.59', 'localhost', '*')

You can also turn on debug logging for multitier in settings.py in order to check which database is used.

    'multitier': {
        'handlers': [],
-       'level': 'INFO',
+       'level': 'DEBUG',
    },

Let me know if that solves the issue. Thank you.

smirolo avatar Jul 20 '18 22:07 smirolo