My first Django site

     It's a very simple one, I don't want record the detail steps, because I learn it from other guy's Blog.  I just want to note two problems I meet..
  
    The first one is simple and stupid, I used function render_to_response, when I view my page('GET'), I got an error say, render_to_response is not defined. It's easy to solve it:
    import render_to_response


    Second one, When I try to POST some info to server, got an exception say "No CSRF or session cookie". It cause me sometime to search the solution, finally got a way:
    Add these two options in your MIDDLEWARE_CLASSES which is in setting.py of your project
        'django.middleware.csrf.CsrfViewMiddleware',
        'django.middleware.csrf.CsrfResponseMiddleware',


   My simple site works well now, job is done today...

0 评论: