Django管理服务器在127.0.0.1:<port>/admin/URL为hi时关闭

2024-04-25 22:35:35 发布

您现在位置:Python中文网/ 问答频道 /正文

使用Django文档开发我的第一个Django项目https://docs.djangoproject.com/en/3.0/intro/tutorial02/

我已经进入了管理部分,但是只要我输入/admin/,Django服务器就会关闭,没有错误消息(比如按CTRL+C)。在

我所做的一切 1在其他端口上运行服务器 2创建一个新的Django项目 三。已从任务管理器停止python进程

它让我抓狂,因为当我进入127.0.0.1:<port>/app/index时它工作得很好 但服务器在

下面是django服务器日志

File ...Python\Python37-32\Lib\stringprep.py first seen with mtime 1530068518.0
File ...Lib\site-packages\django\contrib\auth\migrations\0001_initial.py first seen with mtime 1575315232.7083857
File ...Lib\site-packages\django\contrib\auth\migrations\0004_alter_user_username_opts.py first seen with mtime 1575315232.7103803
File ...Lib\site-packages\django\contrib\admin\migrations\__init__.py first seen with mtime 1575315232.064109
File ...Lib\site-packages\django\contrib\contenttypes\migrations\0001_initial.py first seen with mtime 1575315232.9317892
File ...Lib\site-packages\django\contrib\auth\migrations\0005_alter_user_last_login_null.py first seen with mtime 1575315232.711378
File ...Lib\site-packages\PIL\_imaging.cp37-win32.pyd first seen with mtime 1575317072.293999
File ...Lib\site-packages\django\contrib\admin\templatetags\admin_list.py first seen with mtime 1575315232.244624
File ...Lib\site-packages\django\contrib\auth\migrations\0009_alter_user_last_name_max_length.py first seen with mtime 1575315232.7153673
File ...Lib\site-packages\django\contrib\auth\migrations\0003_alter_user_email_max_length.py first seen with mtime 1575315232.709383
(0.000) SELECT "django_session"."session_key", "django_session"."session_data", "django_session"."expire_date" FROM "django_session" WHERE ("django_session"."expire_date" > '2019-12-08 00:29:28.033564' AND "django_session"."session_key" = '2okb8vdor5ydpa06vd97opvzhuqyxt51') LIMIT 21; args=('2019-12-08 00:29:28.033564', '2okb8vdor5ydpa06vd97opvzhuqyxt51')
(0.000) SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = 1 LIMIT 21; args=(1,)


Tags: djangopyauthsessionmigrationslibpackageswith
2条回答

你查过服务器日志了吗?上面写着什么?在

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
    'file': {
        'level': 'DEBUG',
        'class': 'logging.FileHandler',
        'filename': '/path/to/django/debug.log',
    },
},
'loggers': {
    'django': {
        'handlers': ['file'],
        'level': 'DEBUG',
        'propagate': True,
    },
},

}

这是一个django3.0的问题,很多人都有同样的问题。尝试降级到另一个版本,2.2可以

相关问题 更多 >

    热门问题