静态根 - Django版本2.0.1

时间:2018-01-04 20:33:44

标签: python django python-3.6 django-staticfiles

从Django 1.10升级到2.01。

Settings.py(尚未更改)

PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATIC_URL = os.path.join('/processor/', 'static/')

python manage.py collectstaticpython manage.py runserver都会返回以下相同的错误:

hal@hal:~/CSsite$ python manage.py runserver

Performing system checks...

System check identified no issues (0 silenced).

Django version 2.0.1, using settings 'CSsite.production'

Starting development server at http://127.0.0.1:8000/

Quit the server with CONTROL-C.

[ERROR] (Thread-1  ) Internal Server Error: / Traceback (most recent call last):

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)

  File "/home/hal/CSsite/processor/views.py", line 108, in index
    return render(request, 'processor/select.html', dic)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/shortcuts.py", line 36, in render
    content = loader.render_to_string(template_name, context, request, using=using)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/template/backends/django.pstaticfilesy", line 61, in render
    return self.template.render(context)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 175, in render
    return self._render(context)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 167, in _render
    return self.nodelist.render(context)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 943, in render
    bit = node.render_annotated(context)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/template/base.py", line 910, in render_annotated
    return self.render(context)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/templatetags/static.py", line 106, in render
    url = self.url(context)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/templatetags/static.py", line 103, in url
    return self.handle_simple(path)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/templatetags/static.py", line 118, in handle_simple
    return staticfiles_storage.url(path)

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/utils/functional.py", line 215, in inner
    self._setup()

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 494, in _setup
    self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 379, in __init__
    self.hashed_files = self.load_manifest()

  File "/home/hal/anaconda3/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 401, in load_manifest
    (self.manifest_name, self.manifest_version)) ValueError: Couldn't load manifest 'staticfiles.json' (version 1.0)

[ERROR] (Thread-1  ) "GET / HTTP/1.1" 500 27

请告知。

0 个答案:

没有答案