Notes for Studying Django

时间:2024-01-07 09:06:32
  1. Once you added a new application to INSTALLED_APPS, the database tables need to be updated, thus you need to run python manage.py syncdb.
  2. Normally the server auto-reloads code every time you modify a file, but creating a new file does not trigger the auto-reloading logic. If a new file is added you need to restart the development server by using python manage runserver.
  3. The url() function is passed four arguments, two required: regex and view, and two optional: kwargs, and name.
  4. Each view is responsible for doing one of two things: returning an HttpResponse object containing the content for the requested page, or raising an exception such as Http404.