I want to let a user sign in before seeing pages. Is there any built-in template for user sign in, so that I do not have to write my own sign in page?
Yes. You can read all about it here: https://docs.djangoproject.com/en/1.8/topics/auth/default/#django.contrib.auth.decorators.login_required ... but here are some bullet points:
'django.contrib.auth.middleware.AuthenticationMiddleware' to MIDDLEWARE_CLASSES in settings.py'django.contrib.auth' and 'django.contrib.contenttypes' to INSTALLED_APPS in settings.pydjango.contrib.auth.views.login for the view, such as url(r'^login/$', 'django.contrib.auth.views.login',name="my_login")views.py...
from django.contrib.auth.decorators import login_required
@login_required
def home(request):
return HttpResponse('Home Page')
By default, you then put the template inside my_template_directory/registration/login.html . Further info about that template can be found at the link in the beginning of this post.