Open SoulRaven opened 9 years ago
I'm sorry, that's a mistake in the example. You can solve it by replacing blog.children.add
with blog.add
. I'll update the README to reflect this.
Feel free to report subsequent errors in README here :)
New error:
Traceback (most recent call last):
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/gunicorn/workers/ggevent.py", line 192, in init_process
super(GeventWorker, self).init_process()
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process
self.wsgi = self.app.wsgi()
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/gunicorn/util.py", line 355, in import_app
__import__(module)
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/gevent/builtins.py", line 58, in __import__
result = _import(*args, **kwargs)
File "/mnt/usb500G/pyProjectsEnv/proGeekAPI/proGeekAPI/wsgi.py", line 16, in <module>
application = get_wsgi_application()
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
django.setup()
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/django/apps/registry.py", line 115, in populate
app_config.ready()
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/navutils/apps.py", line 10, in ready
menu.registry.autodiscover(settings.INSTALLED_APPS)
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/persisting_theory/registries.py", line 107, in autodiscover
module = __import__(package)
File "/mnt/usb500G/pyProjectsEnv/proGeekEnv/local/lib/python2.7/site-packages/gevent/builtins.py", line 58, in __import__
result = _import(*args, **kwargs)
File "/mnt/usb500G/pyProjectsEnv/proGeekAPI/dashboard_main/menu.py", line 11, in <module>
assert blog.get_url() == '/api'
AssertionError
menu.py:
from navutils import menu
main_menu = menu.Menu('main')
menu.register(main_menu)
# will be shown to everybody
blog = menu.Node(id='blog', label='Blog', pattern_name='api:index')
main_menu.register(blog)
# nodes created with a pattern_name argument will use django reverse
assert blog.get_url() == '/api'
# if you want to disable reversion, use the url argument
django = menu.Node(id='django',
label='Django project',
url='http://djangoproject.com',
link_attrs={'target': '_blank'})
# Each node instance can accept an arbitrary number of children
blog.add(
menu.Node(id='last_entries',
label='Last entries',
pattern_name='api:index')
)
blog.add(
menu.Node(id='archives', label='Archives', pattern_name='api:index')
)
# will be shown to anonymous users only
login = menu.AnonymousNode(id='login',
label='Login',
pattern_name='accounts_login',
link_attrs={'class': 'big-button'})
main_menu.register(login)
# will be shown to authenticated users only
#logout = menu.AuthenticatedNode(id='logout',
# label='Logout',
# pattern_name='accounts_logout')
#main_menu.register(logout)
dashboard_main/urls.py:
try:
from django.conf.urls import *
except ImportError: # django < 1.4
from django.conf.urls.defaults import *
from dashboard_main import views
# Routers provide an easy way of automatically determining the URL conf.
urlpatterns = [
url(r'^', views.index, name='index'),
]
app urls.py:
urlpatterns = patterns(
'',
url(r'^$', include('dashboard_main.urls', namespace='api'), name="Home"),
url(r'^status/', include('watchman.urls')),
url(r'^accounts/', include('registration.backends.default.urls')),
url(r'^api/geotools/', include('geotools.urls', app_name='Geotools', namespace='Geotools'), name='Geotools'),
url(r'^api/tinyurl/', include('tiny_url.urls', app_name='TinyUrl', namespace='TinyUrl'), name='TinyUrl'),
url(r'^api-auth/', include('rest_framework.urls', namespace="rest_framework")),
url(r'^admin_tools/', include('admin_tools.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^docs/', include('rest_framework_swagger.urls'))
)
Please comment the assert line and replace it with print(blog.get_url())
. What is the output ?
I think it is /api/
, which is why the assertion fails.
no problem, is my pleasure
even when i user template='materials/navutil/material_top_menu.html', inside the node, the default ul tag is render along side with my personal template
normally ul tag will not to be rended
I think that u should reset the 'assert'...And,I'm sorry,I know my English is very terrible.....o(╥﹏╥)o
a new error is rised:
Menu file: