无法解析网址。收到错误 - 反向“satchmo_search”带参数 '()'和关键字参数 '{}'未找到

发布于 2024-10-19 06:14:25 字数 1553 浏览 5 评论 0原文

我按照以下说明安装 Satchmo: http://forum.webfaction.com/ viewtopic.php?pid=10579#p10579

当我想检查我的安装时,出现以下错误:

$ python manage.py satchmo_check
Checking your satchmo configuration.
Using Django version 1.2.5
Using Satchmo version 0.9.2-pre hg-unknown
The following errors were found:
Unable to resolve url. Received error- Reverse for 'satchmo_search' with arguments '()' and keyword arguments '{}' not found.

我的 urls.py 如下所示:

from django.conf.urls.defaults import *
from satchmo_store.urls import urlpatterns

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^myproject/', include('myproject.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/', include(admin.site.urls)),
)

使用 reverse 函数在命令行上,我得到:

$ python manage.py shell
Python 2.7.1 (r271:86832, Dec  1 2010, 06:29:57) 
>>> from django.core.urlresolvers import reverse
>>> reverse(satchmo_search)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
NameError: name 'satchmo_search' is not defined

我是 Satchmo 和 Django 的新手,所以任何帮助将不胜感激。

I'm installing Satchmo following these instructions: http://forum.webfaction.com/viewtopic.php?pid=10579#p10579

When I want to check my installation, I get the following error:

$ python manage.py satchmo_check
Checking your satchmo configuration.
Using Django version 1.2.5
Using Satchmo version 0.9.2-pre hg-unknown
The following errors were found:
Unable to resolve url. Received error- Reverse for 'satchmo_search' with arguments '()' and keyword arguments '{}' not found.

My urls.py looks like this:

from django.conf.urls.defaults import *
from satchmo_store.urls import urlpatterns

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^myproject/', include('myproject.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/', include(admin.site.urls)),
)

Using the reverse function on the command line, I get:

$ python manage.py shell
Python 2.7.1 (r271:86832, Dec  1 2010, 06:29:57) 
>>> from django.core.urlresolvers import reverse
>>> reverse(satchmo_search)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
NameError: name 'satchmo_search' is not defined

I'm new to Satchmo and Django, so any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

诗化ㄋ丶相逢 2024-10-26 06:14:25

您正在覆盖您正在导入的网址。

像这样更改你的 urls.py 文件:

from django.conf.urls.defaults import *
from satchmo_store.urls import urlpatterns

urlpatterns += patterns('',

    # Your urls go here

)

或者

from django.conf.urls.defaults import *
from satchmo_store.urls import urlpatterns as satchmo_urls

urlpatterns = patterns('',

    # Your urls go here

)

urlpatterns += satchmo_urls

You are overriding the urls you are importing.

Change your urls.py file like so:

from django.conf.urls.defaults import *
from satchmo_store.urls import urlpatterns

urlpatterns += patterns('',

    # Your urls go here

)

or

from django.conf.urls.defaults import *
from satchmo_store.urls import urlpatterns as satchmo_urls

urlpatterns = patterns('',

    # Your urls go here

)

urlpatterns += satchmo_urls
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文