title: Use LineProfiler for line-by-line profiling of Django App
body: <p>I want to use line profiler to profile my django project to show the analysis of code performance.</p>
  
  <p>I am following these links: </p>
  
  <ol>
  <li><p><a href="http://djangotricks.blogspot.in/2015/01/performance-bottlenecks-in-django-views.html" rel="noreferrer">http://djangotricks.blogspot.in/2015/01/performance-bottlenecks-in-django-views.html</a></p></li>
  <li><p><a href="https://github.com/dcramer/django-devserver" rel="noreferrer">https://github.com/dcramer/django-devserver</a></p></li>
  </ol>
  
  <p>but this is not working for me.I am getting an error regarding the devserver as below:</p>
  
  <pre><code>Traceback (most recent call last):
    File "manage.py", line 10, in &lt;module&gt;
      execute_from_command_line(sys.argv)
    File "/.virtualenvs/test/lib/python3.4/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
      utility.execute()
    File "/.virtualenvs/test/lib/python3.4/site-packages/django/core/management/__init__.py", line 342, in execute
      self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/.virtualenvs/test/lib/python3.4/site-packages/django/core/management/__init__.py", line 195, in fetch_command
      klass = load_command_class(app_name, subcommand)
    File "/.virtualenvs/test/lib/python3.4/site-packages/django/core/management/__init__.py", line 39, in load_command_class
      module = import_module('%s.management.commands.%s' % (app_name, name))
    File "/.virtualenvs/test/lib64/python3.4/importlib/__init__.py", line 109, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "&lt;frozen importlib._bootstrap&gt;", line 2254, in _gcd_import
    File "&lt;frozen importlib._bootstrap&gt;", line 2237, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 2226, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1200, in _load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 1129, in _exec
    File "&lt;frozen importlib._bootstrap&gt;", line 1467, in exec_module
    File "&lt;frozen importlib._bootstrap&gt;", line 1572, in get_code
    File "&lt;frozen importlib._bootstrap&gt;", line 1532, in source_to_code
    File "&lt;frozen importlib._bootstrap&gt;", line 321, in _call_with_frames_removed
    File "/.virtualenvs/test/lib/python3.4/site-packages/devserver/management/commands/runserver.py", line 29
      raise exc_type, exc_value, tb
                    ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>Note: Versions I am using - Django : 1.9 and python : 3.4</p>