Django - LOCALHOST missing despite other views working
<p><strong>BACKGROUND</strong>:</p>

<p>Worked through Django's tutorial and created multiple views:</p>

<ul>
<li>/admin</li>
<li>/app</li>
</ul>

<p>Currently having issues with "localhost:8000" despite localhost/app and localhost/admin views working (see below):</p>

<p><strong>CODE</strong></p>

<p><strong>Folder Structure (virtualenv):</strong></p>

<pre><code>main/
   db.sqlite3
   manage.py
   app/
      _init_.py
      admin.py
      apps.py
      models.py
      tests.py
      views.py
      urls.py
      migrations/
         _init.py

   main/
      _init_.py
      settings.py
      urls.py
      wsgipy
</code></pre>

<p><em>../main/app/views.py:</em></p>

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


def index(request):
    return HttpResponse("Hello, world. You're at the app index.")
</code></pre>

<p><em>../main/app/urls.py:</em></p>

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

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

<p><em>../main/main/urls.py:</em></p>

<pre><code>from django.conf.urls import include, url
from django.contrib import admin

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^app/', include('app.urls')),
]
</code></pre>

<p><strong>ISSUES/QUESTIONS:</strong></p>

<ol>
<li>localhost/app or localhost/admin shows a rendered page. However, "localhost:8000" does not show the original, django landing page (despite it working before). What am I missing?</li>
<li>Do you recommend any other folder structure? From my understanding, it's poor-form to put /main/main in the location that it currently is. Do you have recommendations on a new folder structure?</li>
</ol>

<blockquote>
  <p>localhost/app or localhost/admin shows a rendered page. However, "localhost:8000" does not show the original, django landing page (despite it working before). What am I missing?</p>
</blockquote>

<p>It looks like <code>main/main/urls.py</code> is your global urls config, which would mean that <code>localhost:8000</code> doesn't have a route defined (only <code>localhost:8000/admin</code> and <code>localhost:8000/app</code>.) You should put the url pattern in the global config. You have defined <code>url(r'^$', views.index, name='index')</code> within app's scope, so Django is actually reading it with <code>app/</code> prepended to it.</p>

<blockquote>
  <p>Do you recommend any other folder structure? From my understanding,
  it's poor-form to put /main/main in the location that it currently is.
  Do you have recommendations on a new folder structure?</p>
</blockquote>

<p>A good structure in my opinion:</p>

<pre><code>server/
  urls.py
  manage.py
  wsgi.py
  settings.py
  apps/
    app1/
    app2/
    app3/
</code></pre>

python django