Django开发服务器登录到管理员后停止 [英] Django development server stops after logging into admin

查看:57
本文介绍了Django开发服务器登录到管理员后停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在python 3.7中安装了django 3.0,并开始了一个基本的django项目.我创建了一个超级用户,并使用 python manage.py runserver 运行开发服务器.当我进入 localhost:8000/admin 时,它向我显示ui登录后,我将其重定向回 localhost:8000/admin ,但此时服务器停止运行在控制台上没有任何错误.

I have installed django 3.0 in python 3.7 and started a basic django project. I have created a superuser and run the development server using python manage.py runserver. When I go to localhost:8000/admin it shows me ui to login after I entered my credentials it redirects back to localhost:8000/admin but at that time server stops running without any error on console.

我在日志文件中看到的最后一条消息是

The last message I see in log file is

(0.002) SELECT "django_session"."session_key", "django_session"."session_data", "django_session"."expire_date" FROM "django_session" WHERE ("django_session"."expire_date" > '2019-12-11T08:52:16.929697+00:00'::timestamptz AND "django_session"."session_key" = 'tqpcf2gv6iqatc42pdmz6zdjpy7iri37') LIMIT 21; args=(datetime.datetime(2019, 12, 11, 8, 52, 16, 929697, tzinfo=<UTC>), 'tqpcf2gv6iqatc42pdmz6zdjpy7iri37')
(0.002) 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,)

有人遇到过这个问题吗?有什么解决方案?

Has someone faced this issue? What could be the solution?

编辑:我发现有人在 reddit 看起来像是django中的错误

I found someone faced same issue in reddit looks like this is a bug in django

卸载django,然后使用 pip install"django> = 2.2,< 3" 安装django 2.2.8.

Uninstalling django then installing django 2.2.8 with pip install "django>=2.2,<3" helped.

推荐答案

要么尝试升级到python 3.8,要么降级到Django 2.2.升级到Python 3.8对我有用.另外,不要忘记将Python 3.8的路径和pip的Path添加到系统的Environment变量中,否则,它将继续使用pip 3.7的路径.

Either try upgrading to python 3.8 or downgrade to Django 2.2. Upgrading to Python 3.8 worked for me. Also, don't forget to add Python 3.8's path and pip's Path to your System's Environment variable, otherwise, it'll keep using pip 3.7's path.

这篇关于Django开发服务器登录到管理员后停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆