jazzband / django-hosts

Dynamic and static host resolving for Django. Maps hostnames to URLconfs.
http://django-hosts.rtfd.org
Other
968 stars 104 forks source link

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

Open VenkateshDharavath opened 4 years ago

VenkateshDharavath commented 4 years ago

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 !

XJOJIX commented 3 years ago

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.

michaelwpeck commented 2 years ago

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