Reputation: 2216
I gone through earlier queries like this one and some more. But could not find the solution. Issue is the same as mentioned in earlier questions. I'm using django - 1.8.1
and python 2.7
urls.py:
from django.conf.urls import include, url
from django.contrib import admin
from mysite.myapp import views
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^$', views.helloWorld, name="HelloWorld"),
]
views.py:
def helloWorld(request):
"""
"""
return render("login.html", {})
settings.py:
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
SECRET_KEY = ')j+s&4t((&gq#5%acu(jw-&!qyp004hal)yzic50d5a%au^qjz'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mysite.myapp',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'mysite.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ["/home/laxmikant/Work/mysite/mysite/templates/"],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'mysite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
STATIC_URL = '/static/'
And the directory structure:
├── db.sqlite3
├── manage.py
└── mysite
├── __init__.py
├── myapp
│ ├── admin.py
│ ├── __init__.py
│ ├── migrations
│ │ └── __init__.py
│ ├── models.py
│ ├── tests.py
│ └── views.py
├── settings.py
├── templates
│ └── login.html
├── urls.py
└── wsgi.py
Upvotes: 0
Views: 171
Reputation: 1210
Your issue is the render call, try to call the function like this render(request, 'login.html', {})
, must do the trick.
Upvotes: 2