Python新手 - Django,需要读取日志

我已经交给了一个用Python构建的应用程序 - Django . 我需要支持它 . 没有移交或类似的东西 . 皮蒂我!我是这种语言和框架的新手 . 当我尝试使用 python manage.py runserver 运行服务器时出现以下错误:

.wrapper在0x108f48e18启动的线程中的未处理异常> Traceback(最近一次调用最后一次):文件“/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/utils/autoreload .py“,第228行,在包装器fn(* args,** kwargs)文件”/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/core/management/commands /runserver.py“,第116行,在inner_run中autoreload.raise_last_exception()文件”/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/utils/autoreload.py“,第251行,在raise_last_exception six.reraise(* _ exception)文件“/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/utils/six.py”,第685行,在重新提升value.with_traceback(tb)文件“/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/utils/autoreload.py”,第228行,在包装器fn中(* args,** kwargs)文件“/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/init.py”,第27行,在设置中apps.populate(settings.INSTALLED_APPS)文件“/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/apps/registry.py”,第85行,填充app_config = AppConfig .create(entry)文件“/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/apps/config.py”,第94行,在create module = import_module(entry)中在import_module中输入文件“/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/importlib/init.py”,第127行,返回_bootstrap._gcd_import(name [level:],package,level)文件“ “,行1006,在_gcd_import文件”“,第983行,在_find_and_load文件”“,第967行,在_find_and_load_unlocked文件”“,第677行,在_load_unlocked文件”“,第728行,在exec_module文件”“,第219行,在_call_with_frames_removed文件“/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/contrib/admin/init.py”,第4行,来自django.contrib.admin.filters import(文件“/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/co ntrib / admin / filters.py“,第10行,来自django.contrib.admin.options import IncorrectLookupParameters File”/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/ contrib / admin / options.py“,第12行,来自django.contrib.admin导入助手,小部件文件”/Users/atariq/Sites/Python_Stuff/123/venv/lib/python3.7/site-packages/django/ contrib / admin / widgets.py“,第152行'%s =%s'%(k,v)为k,v为params.items(),^

我无法理解它的内容 . 有人可以指导我吗?我用pip为项目安装了所有必需的包 .

我使用的是Python 3.7并使用virtualenv .

UPDATE

我开始知道该项目适用于Python 3.6,所以我安装它并仍然获得相同类型的错误日志 . Pip Freeze给了我这个:

asgiref==1.1.2
attrs==18.2.0
autobahn==18.11.2
Automat==0.7.0
certifi==2018.11.29
channels==1.1.6
chardet==3.0.4
constantly==15.1.0
coreapi==2.3.3
coreschema==0.0.4
daphne==1.3.0
defusedxml==0.5.0
dj-database-url==0.5.0
Django==1.11.12
django-allauth==0.32.0
django-cors-headers==2.4.0
django-debug-toolbar==1.9.1
django-filter==2.0.0
django-jsonview==1.2.0
django-prometheus==1.0.13
django-pyodbc-azure==1.11.12.1
django-watchman==0.15.0
djangorestframework==3.7.7
djangorestframework-camel-case==0.2.0
djangorestframework-jwt==1.11.0
djangorestframework-xml==1.3.0
docutils==0.13.1
drf-yasg==1.6.2
future==0.17.1
gevent==1.2.2
greenlet==0.4.15
hyperlink==18.0.0
idna==2.7
incremental==17.5.0
inflection==0.3.1
itypes==1.1.0
Jinja2==2.10
ldap3==2.3
MarkupSafe==1.1.0
oauthlib==2.1.0
openapi-codec==1.3.2
Pillow==5.3.0
prometheus-client==0.5.0
pyasn1==0.4.4
Pygments==2.3.0
PyHamcrest==1.9.0
PyJWT==1.7.1
pyodbc==4.0.23
python-dateutil==2.6.1
python3-openid==3.1.0
pytz==2018.7
raven==6.7.0
requests==2.20.1
requests-oauthlib==1.0.0
ruamel.yaml==0.15.81
six==1.11.0
sqlparse==0.2.4
Twisted==18.9.0
txaio==18.8.1
ua-parser==0.8.0
uritemplate==3.0.0
urllib3==1.24.1
user-agents==1.1.0
uWSGI==2.0.17
zope.interface==4.6.0

Manage.py

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ProjectName.settings.development")
    try:
        from django.core.management import execute_from_command_line
    except ImportError:
        # The above import may fail for some other reason. Ensure that the
        # issue is really that Django is missing to avoid masking other
        # exceptions on Python 2.
        try:
            import django
        except ImportError:
            raise ImportError(
                "Couldn't import Django. Are you sure it's installed and "
                "available on your PYTHONPATH environment variable? Did you "
                "forget to activate a virtual environment?"
            )
        raise
    execute_from_command_line(sys.argv)

问候

回答(3)

2 years ago

它似乎与Python 3.7和您当前的Django版本不兼容 . 您可以在similar问题中找到更多详细信息我可以建议升级您的Django 2或使用Python 3.6 .

Here你可以看到Python 3.7与Django 1.11.17版本兼容 .

2 years ago

谢谢大家的帮助 .

经过大量的讨论,我发现req.txt文件中缺少很多模块,这些模块是构建项目所必需的 . 在其他一些文件中提到了它们 .

安装完所有必需的模块并运行迁移后,我就可以运行该项目了 .

2 years ago

我们能否看到代码u a =写在 manage.py 谁曾试过python的第一个tym他们做了一个非常基本的错误的inidnantion . 虽然它会在某个时候出现inditnation错误但它会抛出一些其他优先级错误 . !检查INDINANATION