I want to use line profiler to profile my django project to show the analysis of code performance.
I am following these links:
but this is not working for me.I am getting an error regarding the devserver as below:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
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 "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1467, in exec_module
File "<frozen importlib._bootstrap>", line 1572, in get_code
File "<frozen importlib._bootstrap>", line 1532, in source_to_code
File "<frozen importlib._bootstrap>", 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
Note: Versions I am using - Django : 1.9 and python : 3.4
It appears that django-devserve
r currently doesn't support python3.
There is a github issue and pull request to fix that. You either have to use python2 or wait till it completely supports python3.