django-hosts icon indicating copy to clipboard operation
django-hosts copied to clipboard

subdomain.example.com works fine on local machine but throws "This site can’t be reached" on server after deployed.

Open VenkateshDharavath opened this issue 5 years ago • 2 comments

hello, I'm using django-hosts in my project to route to different sub-domains. It is working quite well on my loca machine, windows 10, but on server( linux, centos 7) it is throwing an error. I've deployed my django app with mod_wsgi-express. hosts.py

#hosts.py

from django.conf import settings
from django_hosts import patterns, host

host_patterns = patterns('',
host(r'www', settings.ROOT_URLCONF, name='www'),
host(r'campus', 'Portal.urls', name='portal'),
)

portal urls.py

from django.conf.urls import url, include
from django.contrib.auth import views as auth_views
from .import views

urlpatterns = [
url(r'^$', auth_views.LoginView.as_view(template_name='Portal/login.html'), name='home'),
]

This set of codes are working cool, when i hit campus.localhost:8000 on local machine the desired pages are showing up. but when the same app is deployed, campus.example.com says This site cant be reached. I'm a new to webservers, if i have to change anything like host configurations on my server or anything related to DNS please give me inputs, I have very limited knowledge on these things, I'd really appreciate your contribution. Thank you !

VenkateshDharavath avatar Nov 15 '19 19:11 VenkateshDharavath

It seems more like a web-server or DNS problem.

check your dns setting make sure your subdomain targets your sever's ip as well.

second, if DNS setting is right, check your apache virtualhost setting.

XJOJIX avatar Dec 09 '20 06:12 XJOJIX

Could anyone provide an example on how to setup Apache to direct multiple subdomains to a single wsgi file?

michaelwpeck avatar Jan 27 '22 20:01 michaelwpeck