Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test crashes - u'admin' is not a registered namespace #90

Closed
daGrevis opened this issue Apr 20, 2013 · 9 comments
Closed

Test crashes - u'admin' is not a registered namespace #90

daGrevis opened this issue Apr 20, 2013 · 9 comments

Comments

@daGrevis
Copy link

https://travis-ci.org/daGrevis/daGrevis.lv/jobs/6494392

W/o suit, there isn't such error.

@darklow
Copy link
Owner

darklow commented Apr 20, 2013

Does test crashes also when running standalone or only when running on TravisCI?

@daGrevis
Copy link
Author

It happens locally too!

http://vpaste.net/Cr2l8

@orlandpm
Copy link

orlandpm commented May 4, 2013

+1, both on cloud CI and locally

@bkonkle
Copy link

bkonkle commented May 20, 2013

I'm getting this error locally, and I'm also getting it when my site with django-suit is deployed to Heroku. When I navigate to /admin/ I get a 500 for the "not a registered namespace" issue. I'm troubleshooting now.

Django: 1.5.1
django-suit: 0.2.1
django-suit-redactor: 0.0.2

When running locally, navigating to /admin/ does not produce the error. Running the tests does, however, as daGrevis indicated above.

@bkonkle
Copy link

bkonkle commented May 20, 2013

It's happening when it looks for 'admin:logout' because the user does not have permissions.

screen shot 2013-05-20 at 12 25 37 pm

@bkonkle
Copy link

bkonkle commented May 20, 2013

I had a circular import problem. I had a ModelForm in one of my admin.py files that needed to use reverse()

class PostForm(ModelForm):

    class Meta:
        model = Post
        widgets = {
            'body': RedactorWidget(editor_options={
                'lang': 'en',
                'imageUpload': reverse('upload_photos'),
                'imageGetJson': reverse('recent_photos'),
            })
        }

This was a problem because reverse() imports urls.py which hits autodiscover() which imports this admin.py which was trying to use reverse().

To avoid it, I was running autodiscover() after I had already imported my application urls:

urlpatterns = patterns('',
    (r'', include('myproject.app.urls')),
)

admin.autodiscover()

urlpatterns += patterns('',
    (r'^admin/', include(admin.site.urls)),
)

As a workaround until I find a better solution, I simply hardcoded the url into admin.py and am calling autodiscover() at the top of my urls.py again. This solves the problem for me when deployed on Heroku. I can navigate to '/admin/' now without an error.

The tests, however, still complain about the registered namespace problem. I wasn't able to trace why that is happening.

@AnthonyBRoberts
Copy link

Does anyone have a solution for dealing with the django test error:
NoReverseMatch: u'admin' is not a registered namespace
I've been hunting for info on this error for weeks, didn't realize it was a Suit issue.

@darklow
Copy link
Owner

darklow commented Feb 24, 2014

After third attempt investigating this issue, i finally found the solution.
Please try latest develop version and see if it fixes the problem for you.

pip uninstall django-suit
pip install https://github.com/darklow/django-suit/tarball/develop

@AnthonyBRoberts
Copy link

Thank you. Tests now pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants