简体   繁体   English

在管理控制台中更新用户页面时,django管理页面不会发布

[英]django admin page will not post when updating user pages in admin console

I'm trying to deploy a django site. 我正在尝试部署Django网站。 It appears to work correctly, however in the admin site, it appears that POST is not working for updating user accounts. 它似乎可以正常工作,但是在管理站点中,似乎POST无法用于更新用户帐户。

the error response is located here: http://dpaste.com/0CKD2CS 错误响应位于此处: http : //dpaste.com/0CKD2CS

My question here, is if django-admin is running normally, why would a website not find the page in a POST setting? 我的问题是,如果django-admin运行正常,为什么网站无法在POST设置中找到该页面?

Thank you. 谢谢。

The FileNotFoundError in this case actually originates with an attempt to read a "format file", which is used by Django for determining locale-specific formats for things like dates, times, and currency display. 在这种情况下, FileNotFoundError实际上是由于尝试读取“格式文件”而产生的,Django使用它来确定日期,时间和货币显示等特定于语言环境的格式。 In this case it's on the DATE_INPUT_FORMATS for the DateField . 在这种情况下,它位于DateFieldDATE_INPUT_FORMATS

Django allows the path for formats to be specified in settings: Django允许在设置中指定格式的路径:

https://docs.djangoproject.com/en/1.8/ref/settings/#format-module-path https://docs.djangoproject.com/en/1.8/ref/settings/#format-module-path

Otherwise there are a number of these configured in a locale directory in the Django distribution - .../lib/python2.7/site-packages/django/conf/locale . 否则,在Django发行版的语言环境目录中配置了许多配置文件.../lib/python2.7/site-packages/django/conf/locale For example: 例如:

../lib/python2.7/site-packages/django/conf/locale/en_AU/formats.py
19:DATE_INPUT_FORMATS = (
20-    '%d/%m/%Y', '%d/%m/%y',             # '25/10/2006', '25/10/06'
21-    # '%b %d %Y', '%b %d, %Y',          # 'Oct 25 2006', 'Oct 25, 2006'
22-    # '%d %b %Y', '%d %b, %Y',          # '25 Oct 2006', '25 Oct, 2006'
23-    # '%B %d %Y', '%B %d, %Y',          # 'October 25 2006', 'October 25, 2006'
24-    # '%d %B %Y', '%d %B, %Y',          # '25 October 2006', '25 October, 2006'
25-)

Worth examining the effective locale and associated files. 值得检查有效的语言环境和相关文件。 If you can live with disabling the translation machinery, or perhaps at least while troubleshooting, you can set USE_I18N=False in settings . 如果您可以停用翻译机制,或者至少在进行故障排除时,可以在settings设置USE_I18N=False

Possibly worth perusing the Django Internationalization and Localization docs. 可能值得仔细阅读Django 国际化和本地化文档。

Django will use en if there isn't a country-specific format module, so that will be fine. 如果没有特定国家/地区的格式模块,则Django将使用en ,因此可以。 You can try using a Django shell in the project to attempt the equivalent call: 您可以尝试在项目中使用Django Shell尝试进行等效调用:

$ ./manage.py shell
>>> import datetime
>>> datetime.datetime.strptime('2015-10-19', '%Y-%m-%d').date()
datetime.date(2015, 10, 19)

The only place there is Django-related file I/O is in the loading of the format module so as long as django/conf/locale/en/formats.py is available then the possibilities for such failure are limited, failing something strange happening with datetime , which seems improbable. 与Django相关的文件I / O唯一的地方是在format模块的加载中,只要django/conf/locale/en/formats.py可用,那么这种失败的可能性就受到限制,使某些奇怪的事情失败与datetime ,这似乎是不可能的。 There is a fallback for the formats in that Django will retrieve from settings , so you could add this line to your settings : Django将从settings检索格式的备用,因此您可以将此行添加到settings

DATE_INPUT_FORMATS = ( '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM