Opened 12 years ago
Closed 12 years ago
#22544 closed Bug (invalid)
Error happened when I use LiveServerTestCase to test static file
| Reported by: | lifeng | Owned by: | nobody |
|---|---|---|---|
| Component: | Testing framework | Version: | 1.7-beta-2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
I know I should use StaticLiveServerCase to test static file, and when I use it, everything is OK. But when I use LiveServerTestCase to test static file, some error occurred. Bellow is the error message:
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
.Traceback (most recent call last):
File "/usr/lib/python3.3/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-packages/django/test/testcases.py", line 1011, in __call__
return super(FSFilesHandler, self).__call__(environ, start_response)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-packages/django/core/handlers/wsgi.py", line 187, in __call__
response = self.get_response(request)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-packages/django/test/testcases.py", line 994, in get_response
return self.serve(request)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-packages/django/test/testcases.py", line 1006, in serve
return serve(request, final_rel_path, document_root=self.get_base_dir())
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/site-packages/django/views/static.py", line 50, in serve
fullpath = os.path.join(document_root, newpath)
File "/home/lf/.virtualenvs/django1.7/lib/python3.3/posixpath.py", line 83, in join
path += b
The document_root is None, Is there anything wrong in https://github.com/django/django/blob/stable/1.7.x/django/test/testcases.py#L993
Change History (2)
comment:2 by , 12 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
It looks like you need to set settings.STATIC_ROOT to avoid that exception.
Note:
See TracTickets
for help on using tickets.
Sorry, I forgot to tell my environment, it's python3.3, django1.7.2.