Ошибка типа: _getfullpathname: путь должен быть строкой, байтами или os.PathLike, а не функцией (ошибка wsgi.py) - PullRequest
0 голосов
/ 24 января 2019

Я разработал этот проект django на Ubuntu, используя Django 2.0 и Postgresql, он работал нормально, прежде чем я клонировал его для работы на Windows. После переноса баз данных при запуске python manage.py runserver выдается ошибка следующего типа.

Traceback Выполнение системных проверок ...

System check identified no issues (0 silenced).
January 24, 2019 - 20:02:45
Django version 2.1.2, using settings 'main.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x03A378A0>
Traceback (most recent call last):
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\core\management\commands\runserver.py", line 137, in inner_run
    handler = self.get_handler(*args, **options)
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in
get_handler
    handler = super().get_handler(*args, **options)
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\core\management\commands\runserver.py", line 64, in get_handler
    return get_internal_wsgi_application()
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\core\servers\basehttp.py", line 44, in get_internal_wsgi_application
    return import_string(app_path)
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "C:\python3\Lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\HP\Desktop\django\crowd-social\main\main\wsgi.py", line 19, in <module>
    application = get_wsgi_application()
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
    return WSGIHandler()
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\core\handlers\wsgi.py", line 136, in __init__
    self.load_middleware()
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\core\handlers\base.py", line 36, in load_middleware
    mw_instance = middleware(handler)
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\contrib\staticfiles\storage.py", line 376, in __init__
    self.hashed_files = self.load_manifest()
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\contrib\staticfiles\storage.py", line 386, in load_manifest
    content = self.read_manifest()
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\contrib\staticfiles\storage.py", line 380, in read_manifest
    with self.open(self.manifest_name) as manifest:
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\core\files\storage.py", line 33, in open
    return self._open(name, mode)
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\core\files\storage.py", line 218, in _open
    return File(open(self.path(name), mode))
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\contrib\staticfiles\storage.py", line 42, in path
    if not self.location:
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\utils\functional.py", line 37, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "C:\Users\HP\Desktop\django\crowd-social\crowdsocial_env\lib\site-packages\django\core\files\storage.py", line 201, in location
    return os.path.abspath(self.base_location)
  File "C:\python3\Lib\ntpath.py", line 526, in abspath
    return normpath(_getfullpathname(path))

TypeError: _getfullpathname: path should be string, bytes or os.PathLike, not function

wsgi.py

import os
from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", 'main.settings')
application = get_wsgi_application()

Ошибка возникает из этой строки application = get_wsgi_application().

...