noirbizarre / django.js

Javascript tools for Django
http://djangojs.readthedocs.org/en/latest/
GNU Lesser General Public License v3.0
181 stars 81 forks source link

No module named app_resolver #7

Closed ikresoft closed 11 years ago

ikresoft commented 11 years ago

after using 0.3.2 version I get this error No module named app_resolver?

noirbizarre commented 11 years ago

app_resolver is unknown to me. It doesn't seems to be a django.js error. Can you describe a little bit more the problem ?

ikresoft commented 11 years ago

Environment:

Request Method: GET Request URL: http://www.faretti-shoes.com/djangojs/urls

Django Version: 1.4.2 Python Version: 2.6.6 Installed Applications: ('admin_tools', 'admin_tools.theming', 'admin_tools.menu', 'admin_tools.dashboard', 'is_admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.comments', 'django.contrib.sitemaps', 'djangojs', 'dajaxice', 'tagging', 'pagination', 'filebrowser', 'ikresoft.ext', 'tinymce', 'cms', 'mptt', 'menus', 'south', 'reversion', 'sekizai', 'cms.plugins.flash', 'cms.plugins.link', 'cms.plugins.snippet', 'cms.plugins.text', 'cms.plugins.twitter', 'cms.plugins.inherit', 'cmsplugin_youtube', 'cmsplugin_contact', 'ikresoft.gallery', 'ikresoft.articles', 'registration', 'profiles', 'haystack', 'rosetta', 'nani', 'filer', 'cmsplugin_filer_file', 'cmsplugin_filer_folder', 'cmsplugin_filer_image', 'cmsplugin_filer_teaser', 'cmsplugin_filer_video', 'categories', 'ikresoft.editor', 'openshop', 'shop', 'shop.addressmodel', 'ikresoft.barkod', 'sifarnik', 'kolekcija', 'proizvodnja', 'zaposleni', 'plate', 'debug_toolbar') Installed Middleware: ('django.middleware.gzip.GZipMiddleware', 'django.middleware.cache.UpdateCacheMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.doc.XViewMiddleware', 'pagination.middleware.PaginationMiddleware', 'cms.middleware.multilingual.MultilingualURLMiddleware', 'cms.middleware.page.CurrentPageMiddleware', 'cms.middleware.user.CurrentUserMiddleware', 'cms.middleware.toolbar.ToolbarMiddleware')

Traceback: File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response

  1. response = callback(request, _callback_args, *_callback_kwargs) File "/usr/lib/pymodules/python2.6/django/views/generic/base.py" in view
  2. return self.dispatch(request, _args, *_kwargs) File "/usr/lib/pymodules/python2.6/django/views/generic/base.py" in dispatch
  3. return handler(request, _args, *_kwargs) File "/home/ikresoft/virtual/lib/python2.6/site-packages/django.js-0.3.2-py2.6.egg/djangojs/views.py" in get
  4. data = self.get_context_data(request, _args, *_kwargs) File "/home/ikresoft/virtual/lib/python2.6/site-packages/django.js-0.3.2-py2.6.egg/djangojs/views.py" in get_context_data
  5. return self.get_urls(module) File "/home/ikresoft/virtual/lib/python2.6/site-packages/django.js-0.3.2-py2.6.egg/djangojs/views.py" in get_urls
  6. urls.update(self.get_urls(pattern.urlconf_name, pattern.regex.pattern)) File "/home/ikresoft/virtual/lib/python2.6/site-packages/django.js-0.3.2-py2.6.egg/djangojs/views.py" in get_urls
  7. urls.update(self.get_urls(pattern.urlconf_name, pattern.regex.pattern)) File "/home/ikresoft/virtual/lib/python2.6/site-packages/django.js-0.3.2-py2.6.egg/djangojs/views.py" in get_urls
  8. import(module)

Exception Type: ImportError at /djangojs/urls Exception Value: No module named app_resolver

noirbizarre commented 11 years ago

OK, it seems to be specific to django-cms way of resolving apps: https://github.com/divio/django-cms/blob/master/cms/appresolver.py.

I'll try to fix this issue as soon as possible (I never used django-cms, I'll need to investigate).

noirbizarre commented 11 years ago

Can you provide a sample project to reproduce the bug ? I will try to fix it before the next release (soon)

ikresoft commented 11 years ago

django-cms is using this appresolver to resolve extra apps that doesn't exist in INSTALLED_APPS, so if there dynamic apps connected to pages, appresolver is puting urls of apps to root cms urls.

szelga commented 11 years ago

here's your sample: https://github.com/szelga/js-cms-test (sorry if it's too late).

szelga commented 11 years ago

OK, i managed to fix it: https://github.com/szelga/django.js/commit/10d5082b8c03ab2ecd606fead25a07353a92131c it's kinda quick and dirty, so i dare not to offer it as a pull request. tested with django-cms 2.4.2

noirbizarre commented 11 years ago

It's never too late !!!

I will look at your sample project et your fix ASAP.

2 possibilities:

noirbizarre commented 11 years ago

I can't reproduce the bug with the sample project. With both the provided version (4738b194b273f162032ac57131360c9e0aa65f58 aka. the current master) and the latest stable (0.7.6), I have no error when accessing http://localhost:8000/djangojs/init.js. Am I missing something?

szelga commented 11 years ago

have you created (and published) any django-cms pages? preferrably 2: one standard page and one with an application attached (i have provided a sample application in the project).

noirbizarre commented 11 years ago

Yep, I created pages with and without application, nested pages... no errors.

I excuded admin URLs for better readabiity:

JS_URLS_NAMESPACES_EXCLUDE = (
    'admin',
)

and got this:

{
    "django_js_urls": "/djangojs/urls",
    "myapp-view2": "/test/",
    "js_catalog": "/djangojs/translation",
    "django_js_context": "/djangojs/context",
    "pages-root": "/",
    "django_js_init": "/djangojs/init.js",
    "pages-details-by-slug": "/<slug>/"
}

Are you expecting the pages to appears in ?

szelga commented 11 years ago
  1. on page http://127.0.0.1:8000/admin/cms/page/ create root page with some content, and, say, page with slug 'test2' hooked with 'My App' application (advanced settings tab). make sure that pages are published and you also clicked "publish draft" button. then test it.
  2. post here your pip freeze output.
noirbizarre commented 11 years ago

OK, I'll test it today.

noirbizarre commented 11 years ago

OK, I reproduce the bug but I need to restart the server.

I just took the try...except part of your fix, not the refactoring. Maybe I'll do this refactoring one day, but not as part of a fix.

noirbizarre commented 11 years ago

And thanks for the fix !