Log in

When intergrating with an existing project.

  • 23 Nov '15

When I tried to intergrate Spirit with an existing project, i got an error like below.

AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'

I set up settings.py like example code.

I already have a Django user model, not custom model.
I guess the problem is related to User model.
Could you please help me?

nitelyEsteban Castro Borsani
  • 23 Nov '15

There are many possible causes (ie: it may be related to your project layout). It is hard to say without looking at the code. Is your project open source or can I have access to it somehow? otherwise, post your settings.py and urls.py file here and also your project layout (run $ tree -L 2).

  • 1
  • 23 Nov '15

Hi nitely, I appreciate your interest.
My project is based on wagtail which is django cms tool.
You can check the project layout below. Wagtail tool uses django user model.
I was able to migrate successfully. so I have spirit tables on my sqlite3 file.

oh, name 'search' is duplicated. so I rename split.search to split.splitsearch.

my project layout
.
├── db.sqlite3
├── django.log
├── home
│ ├── init.py
│ ├── pycache
│ ├── migrations
│ ├── models.py
│ └── templates
├── locale
├── manage.py
├── media
│ ├── images
│ └── originalimages
├── nova1492web
│ ├── init.py
│ ├── pycache
│ ├── settings
│ ├── static
│ ├── templates
│ ├── urls.py
│ ├── views.py
│ └── wsgi.py
├── requirements
│ ├── base.txt
│ ├── dev.txt
│ └── production.txt
├── search
│ ├── init.py
│ ├── pycache
│ ├── templates
│ └── views.py
├── spirit
│ ├── init.py
│ ├── __pycache

│ ├── admin
│ ├── category
│ ├── comment
│ ├── core
│ ├── middleware.py
│ ├── settings.py
│ ├── settings_tests.py
│ ├── spiritsearch
│ ├── topic
│ ├── urls.py
│ └── user
└── static
├── admin
├── css
├── fonts
├── img
├── isotope_gallery
├── js
├── layerslider
├── spirit
├── wagtailadmin
├── wagtaildocs
├── wagtailembeds
├── wagtailforms
├── wagtailimages
├── wagtailsnippets
└── wagtailusers

settings.py
https://gist.github.com/initialkommit/00835bbb5a656a3e5744

current DB
auth_group
auth_group_permissions
auth_permission
auth_user
auth_user_groups
auth_user_user_permissions
django_admin_log
django_content_type
django_migrations
django_session
djconfig_config
..
..
spirit_category_category
spirit_comment_bookmark_commentbookmark
spirit_comment_comment
spirit_comment_flag_commentflag
spirit_comment_flag_flag
spirit_comment_history_commenthistory
spirit_comment_like_commentlike
spirit_comment_poll_commentpoll
spirit_comment_poll_commentpollchoice
spirit_comment_poll_commentpollvote
spirit_topic_favorite_topicfavorite
spirit_topic_notification_topicnotification
spirit_topic_poll_topicpoll
spirit_topic_poll_topicpollchoice
spirit_topic_poll_topicpollvote
spirit_topic_private_topicprivate
spirit_topic_topic
spirit_topic_unread_topicunread
spirit_user_userprofile
taggit_tag
taggit_taggeditem
..
..
wagtailusers_userprofile

nitelyEsteban Castro Borsani
  • 1
  • 23 Nov '15

I can't spot anything wrong. Can you post the full traceback? you may have to add file to your loggin handlers.

# ...
'loggers': {
        '': {
            'handlers': ['console', 'mail_admins', 'file'],
            'level': 'ERROR',
            'propagate': False,
        },
        'django': {
            'handlers': ['console', 'mail_admins', 'file'],
            'level': 'ERROR',
            'propagate': False,
        },

Wagtail tool uses django user model.

Spirit as well, I doubt this is related to that.

oh, name 'search' is duplicated. so I rename split.search to split.splitsearch.

You should not have to do that. I just fixed it.

  • 24 Nov '15

Hi~ Thank you for your reply.

loggin handlers
Okay, I added to file to loggin handlers.

Search
Wagtail uses search also. so I renamed it. If I don't rename it, I get an error, "''search' is duplicated."
so I renamed all of 'search' to 'spiritsearch'.

  1. settings.py

    INSTALLED_APPS = [
     ...
     'spirit.spiritsearch',
    ]
  2. spirit/urls.py

    import spirit.spiritsearch.urls
    ...
    url(r'^spiritsearch/', include(spirit.spiritsearch.urls, namespace='search')),

Traceback
https://gist.github.com/initialkommit/cd7f2e636c11147b9721

  • 1
  • 24 Nov '15

@nitely,

I checked full traceback. and I found an error 'mistune.BlockLexer.default_features'.
I used mistune 0.7.1.

In mistune 0.7.1
mistune.BlockLexer.default_features is changed to mistune.BlockLexer.default_rules
ref: https://github.com/lepture/mistune/blob/920f88d4634cc6c70376eecbce12772571d136da/mistune.py

so I get Spirit working now. great. awesome. thank you

nitelyEsteban Castro Borsani
  • 24 Nov '15

Great!

Search
Wagtail uses search also. so I renamed it. If I don't rename it, I get an error, "''search' is duplicated."
so I renamed all of 'search' to 'spiritsearch'.

Yep, should be fixed in the master branch. The aplication config for that app was missing.

nitelyEsteban Castro Borsani
  • 1
  • 24 Nov '15

In mistune 0.7.1
mistune.BlockLexer.default_features is changed to mistune.BlockLexer.default_rules

Maybe, run the Spirit test suite to be sure.

I just updated the master branch to support latest mistune. The renaming did (mostly) the trick.

  • 25 Nov '15

Great, I checked it. - github commit
Thank you for upgrading.

Reply