django Context syntax error
Question: I'm new to Django and try to create a simple blog, but a syntax error keeps
appearing in the views.py file in the Context line. I use Django 1.6, and the
syntax seems compatible with this version. Here's the simple method from
views.py, where I get the error:

    
    
    def archive(request):
        posts = blogPost.objects.all()  
        t = loader.get_template("archive.html") 
        c = Context({'posts': })
    return HttpResponse(t.render(c))
    

Here's the traceback:

    
    
        Environment:
        Request Method: GET
        Request URL: http://127.0.0.1:8000/blog
    
        Django Version: 1.6
        Python Version: 2.7.6
        Installed Applications:
        ('django.contrib.auth',
         'django.contrib.admin',
         'django.contrib.contenttypes',
         'django.contrib.sessions',
         'django.contrib.messages',
         'django.contrib.staticfiles',
         'django.contrib.admindocs',
         'blog')
        Installed Middleware:
        ('django.contrib.sessions.middleware.SessionMiddleware',
         'django.middleware.common.CommonMiddleware',
        'django.middleware.csrf.CsrfViewMiddleware',
         'django.contrib.auth.middleware.AuthenticationMiddleware',
         'django.contrib.messages.middleware.MessageMiddleware',
         'django.middleware.clickjacking.XFrameOptionsMiddleware')
    
    
        Traceback:
        File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
          90.                 response = middleware_method(request)
        File "C:\Python27\lib\site-packages\django\middleware\common.py" in process_request
          71.             if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
        File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in is_valid_path
          573.         resolve(path, urlconf)
        File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in resolve
          453.     return get_resolver(urlconf).resolve(path)
        File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in resolve
          318.             for pattern in self.url_patterns:
        File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in url_patterns
          346.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
        File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in urlconf_module
          341.             self._urlconf_module = import_module(self.urlconf_name)
        File "C:\Python27\lib\site-packages\django\utils\importlib.py" in import_module
          40.         __import__(name)
        File "C:\Python27\Lib\site-packages\django\bin\myblog\myblog\urls.py" in <module>
          12.   url(r'^blog/', include('blog.urls')),
        File "C:\Python27\lib\site-packages\django\conf\urls\__init__.py" in include
          26.         urlconf_module = import_module(urlconf_module)
        File "C:\Python27\lib\site-packages\django\utils\importlib.py" in import_module
          40.         __import__(name)
        File "C:\Python27\Lib\site-packages\django\bin\myblog\blog\urls.py" in <module>
          2. from blog.views import archive
    
        Exception Type: SyntaxError at /blog
        Exception Value: invalid syntax (views.py, line 14)
    


Answer: This line is invalid:

    
    
    c = Context({'posts': })
    

There needs to be a value there:

    
    
    c = Context({'posts': posts})
    

