ANTLR“无法启动调试器。(ANTLR “Cannot launch the debugger. Time-out waiting to connect to the remote parser.”)
在AntlrWorks中运行的一个ANTLR语法引发了:“无法启动调试器。 超时等待连接到远程分析器。“
过去这条消息通常会消失,但这个消息是持久的。 在搜索ANTLR列表时(例如http://www.antlr.org/pipermail/antlr-interest/2009-June/034659.html ),有提示说错误信息与它看起来没什么关系,但可能是语法错误。
有没有人有关于如何“重新启动”或找到这种情况下的错误提示?
One of my ANTLR grammars running in AntlrWorks throws: “Cannot launch the debugger. Time-out waiting to connect to the remote parser.”
In the past this message usually goes away but this one is persistent. On searching the ANTLR lists (e.g. http://www.antlr.org/pipermail/antlr-interest/2009-June/034659.html) there are hints that the error message is nothing to do with what it seems but could be a grammar error.
Has anyone got tips as to how to "reboot" or find the bugs in this situation?
原文:https://stackoverflow.com/questions/1845817
最满意答案
虽然我不确定这个解决方案是否真的是最好的,但它使我能够使用自定义模板,并通过在myappurls.py的url模式中明确填写kwargs中的工作流程来避免反向错误:
from django.contrib.auth import views as auth_views
url(r'^login/$', auth_views.login, {'template_name': 'myapp/registration/login.html'},name='login'), url(r'^logout/$', auth_views.logout, {'next_page': 'myapp:home'},name='logout'), url(r'^password_reset/$', auth_views.password_reset,{'email_template_name':'myapp/registration/password_reset_email.html', 'template_name':'myapp/registration/password_reset_form.html', 'subject_template_name':'myapp/registration/password_reset_subject.txt', 'post_reset_redirect':'myapp:password_reset_done', 'from_email':'myapp@django.com', },name='password_reset'), url(r'^password_reset/done/$', auth_views.password_reset_done, {'template_name': 'myapp/registration/password_reset_done.html'}, name='password_reset_done'), url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.password_reset_confirm, {'template_name': 'myapp/registration/password_reset_confirm.html', 'post_reset_redirect': 'myapp:password_reset_complete'}, name='password_reset_confirm'), url(r'^reset/done/$', auth_views.password_reset_complete, {'template_name': 'myapp/registration/password_reset_complete.html'},name='password_reset_complete'),
更新的答案!
尽管我在给出的第一个答案中找到了解决问题的方法,但我终于明白了真正的问题所在。
问题在于我的项目urls.py和myapp / urls.py之间的命名空间没有正确配置。 为了正确地排列所有内容,我需要将项目urls.py更改为指向app / urls.py并为其命名空间名称:
url(r'^',include('myapp.urls'),name ='myapp)
然后在app / urls.py中,我需要为rever方法分配一个命名空间名称来连接这两个:
app_name ='myapp'
urlpatterns = [ url(r'password_reset / done /',auth_views.password_reset_done,name ='password_reset_done'), url(r'password_reset /',auth_views.password_reset,name ='password_reset'), ]
现在一切都完美无缺,因为它应该没有桶装载的hacky参数。
Though I'm not sure if this solution really is the best, it's enabled me to use custom templates and avoid the reverse errors by explicitly filling out the workflow in kwargs in the urls patterns of the myappurls.py:
from django.contrib.auth import views as auth_views
url(r'^login/$', auth_views.login, {'template_name': 'myapp/registration/login.html'},name='login'), url(r'^logout/$', auth_views.logout, {'next_page': 'myapp:home'},name='logout'), url(r'^password_reset/$', auth_views.password_reset,{'email_template_name':'myapp/registration/password_reset_email.html', 'template_name':'myapp/registration/password_reset_form.html', 'subject_template_name':'myapp/registration/password_reset_subject.txt', 'post_reset_redirect':'myapp:password_reset_done', 'from_email':'myapp@django.com', },name='password_reset'), url(r'^password_reset/done/$', auth_views.password_reset_done, {'template_name': 'myapp/registration/password_reset_done.html'}, name='password_reset_done'), url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.password_reset_confirm, {'template_name': 'myapp/registration/password_reset_confirm.html', 'post_reset_redirect': 'myapp:password_reset_complete'}, name='password_reset_confirm'), url(r'^reset/done/$', auth_views.password_reset_complete, {'template_name': 'myapp/registration/password_reset_complete.html'},name='password_reset_complete'),
UPDATED ANSWER!
Though I found a workaround to my problem in the first answer I gave, I finally understood what the real problem was.
The problem was that the namespaces were not correctly configured between my project urls.py and my myapp/urls.py. To correctly line everything up I needed to change the project urls.py to point to the app/urls.py and give it a namespace name:
url(r'^',include('myapp.urls'), name='myapp)
Then in the app/urls.py I needed to assign it a namespace name for the rever method to connect the two:
app_name = 'myapp'
urlpatterns = [ url(r'password_reset/done/', auth_views.password_reset_done,name='password_reset_done'), url(r'password_reset/', auth_views.password_reset, name='password_reset'), ]
Now everything works perfectly out of the box as it should without a bucket-load of hacky parameters.
相关问答
更多-
NoReverseMatch: Reverse for 'auth_password_reset_confirm' 你有: url(r'^password/reset/(?P
[0-9A-Za-z_\-]+)/(?P [0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.password_reset_confirm, name='password_reset_confirm'), 该url的name属性看起来应该 ... -
将url名称添加到您的urls.py中password_reset_done的条目中: (r'^resetpassword/passwordsent/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'), 在内部, password_reset视图使用reverse('password_reset_done')在重置密码后查找向用户发送的位置。 reverse可以采用函数名称的字符串表示形式,但它需 ...
-
你需要纠正你的urls.py url(r'^reset/(?P
[0-9A-Za-z_\-]+) ...... 至 url(r'^user/password/reset/(?P [0-9A-Za-z_\-]+) ...... Instead setting different urls in urls.py I only set one. url(r'^accounts/', include('django.contrib.auth.urls')), Having this ... -
是的,您可以创建模型并在密码重置/更改时存储用户的所有密码。 from django.contrib.auth.models import User import json class OldPasswords(models.Model): user = model.ForeignKey(User) pwd = models.CharField(max_length=200) def setPasswords(self, pwd): self.pwd = json ...
-
在Django中重置密码(Reset password in Django)[2022-12-16]
在melomanos\urls.py您使用的是url前缀。 urlpatterns = patterns('melomanos.views', url(r'^resetpassword/$', 'django.contrib.auth.views.password_reset', name="reset_password"), ) 所以/resetpassword/正在调用melomanos.views.django.contrib.auth.views.password_reset而不是djan ... -
虽然我不确定这个解决方案是否真的是最好的,但它使我能够使用自定义模板,并通过在myappurls.py的url模式中明确填写kwargs中的工作流程来避免反向错误: from django.contrib.auth import views as auth_views url(r'^login/$', auth_views.login, {'template_name': 'myapp/registration/login.html'},name='login'), url(r'^logout/$', au ...
-
解决方案是在确认模板中设置表单操作 action="" 说来也怪。 The solution was to set form action in the confirm template to action="" oddly enough.
-
Django需要知道如何从url模板标签中使用的名称解析URL。 您应该将名称添加到此行: url(r'^reset/(?P
[0-9A-Za-z]+)-(?P .+)/$', 'django.contrib.auth.views.password_reset_confirm'), 所以它变成了: url(r'^reset/(?P [0-9A-Za-z]+)-(?P .+)/$', 'django.contrib.auth.views.passwor ... -
问题来自于您使用帐户网址的命名空间和视图中使用的Django内置模板。 在模板registration/password_reset_email.html您将看到: {% url 'password_reset_confirm' uidb64=uid token=token %} 但是,您的应用中不存在网址名称password_reset_confirm ,因为您使用了命名空间“accounts” - 该网址变为accounts:password_reset_confirm 。 您可以考虑创建一个单独的文 ...
-
password_reset行应如下所示: url(r'^password_reset/$', auth_views.password_reset, {'post_reset_redirect' : '/accounts/password_reset_done/'}, name='password_reset'), The password_reset line should look like this: url(r'^password_reset/$', auth_views.password_res ...