django-subdomains config localhost
<p>I'm having trouble getting mine configured correctly.</p>

<p>Have sites enabled and site domain for "SITE_ID = 1" (db object 1 domain) set too "mysite.app"</p>

<p>I have these subdomains setup</p>

<pre><code>ROOT_URLCONF = 'mysite.urls'
SUBDOMAIN_URLCONFS = {
    None: 'frontend.urls',  # no subdomain, e.g. ``example.com``
    'www': 'frontend.urls',
    'api': 'api.urls',
}
</code></pre>

<p>etc/hosts file</p>

<pre><code>127.0.0.1       api.mysite.app
127.0.0.1       www.mysite.app
127.0.0.1       mysite.app
</code></pre>

<p>api/urls.py</p>

<pre><code>from django.conf.urls import url
from . import views

urlpatterns = [
    url(r'^$', views.index),
]
</code></pre>

<p>api/views.py</p>

<pre><code>from django.shortcuts import render
from django.http import HttpResponse

def index(request):
    return HttpResponse('API')
</code></pre>

<p>The frontend app urls and views is identical except for returning string "FRONTEND" in the HttpResponse object.</p>

<p>I can tell django-subdomains is working becuase it does go to the "frontend" app when I hit "mysite.app:8000" vs the mysite.urls as seen in the root_url_conf. It displays "FRONTEND"</p>

<p>But no matter what I do I can't get "api.mysite.app:8000" to hit the api urls file to display "API"</p>

<p>Am I missing something? I'm very new to django. Any help is appreciated.</p>

<p>Thanks.</p>

<p>Simply had to restart the dev server. All was configured correctly. </p>

python django