Q: Django 1.11:Apps aren't loaded yet I'm learning how to do web programming with Django framework and I got this error message when I try to return a template. When I try to load https://www..../index2/ everything is ok.
This is my urls.py:
from django.conf.urls import url
from . import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^index2/$', views.index2, name='index2'),
]

This is my views.py:
from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.

def index(request): 
    return render(request, 'main/index.html',)

def index2(request):
    return HttpResponse("Hello, world.")


A: Make sure you have index.html saved under app/templates/main/index.html
if you have debug mode enabled. Exception page will show you the different paths from where django is trying to load index.html. 

A: Thanks.
I added in init.py of my project:
import django
django.setup()

Everything is working correctly. 
However I am facing problems whit module urls when I try to import "reverse" from "django.urls". I get the error "No module named urls". I can't understand why I have this error (for the moment I am using "django.core.urlresolvers" to impor "reverse", but I'd like to understand the mistake)
I am using Django 1.11.16 and python 2.7.
