Note that there are some explanatory texts on larger screens.

plurals
  1. POdjango cms apphook - no module named urls error
    text
    copied!<p>I am learning django-cms. I tried to make custom plugin which was quite successful but when I tried to hook my custom made plugin to apphook, its giving me an error, saying,</p> <blockquote> <p>No Module named urls . </p> </blockquote> <p>I followed the tutorial which was given in django cms sites documentation, and created the cms_app.py file. Currently my application directory has all the files which is required to make a custom plugin for django cms, and an additional file of cms_app.py. </p> <p>Is something wrong with setting of the url or do I need to create a new urls.py file inside my app directory?</p> <p>My cms_app.py is exactly the same as given in the tutorial.</p> <p><strong>EDIT - 1</strong></p> <p>i have created a project called myproject using command - </p> <blockquote> <p>python django-admin.py startproject myproject</p> </blockquote> <p>After referring to the tutorial given for cms I created a plugin called first, using the basic command </p> <blockquote> <p>python manage.py startapp first</p> </blockquote> <p>Now the plugin is working perfectly well, and the directory structure before making an attempt to the apphook was,</p> <pre><code>first/ __init__.py cms_plugins.py models.py tests.py views.py </code></pre> <p>Now after making an attempt to hook the app in apphook, the directory structure is:</p> <pre><code>first/ __init__.py cms_app.py cms_plugins.py models.py tests.py views.py </code></pre> <p>My cms_app.py is as follows: </p> <pre><code>from cms.app_base import CMSApp from cms.apphook_pool import apphook_pool from django.utils.translation import ugettext_lazy as _ class FirstApp(CMSApp): name = _("First App") # give your app a name, this is required urls = ["first.urls"] # link your app to url configuration(s) apphook_pool.register(FirstApp) # register your app </code></pre> <p>i have a urls.py file in myproject folder, and it is as follows:</p> <pre><code>from django.conf.urls.defaults import * from django.contrib import admin from django.conf import settings # Uncomment the next two lines to enable the admin: # from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'myproject.views.home', name='home'), # url(r'^myproject/', include('myproject.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), url(r'^', include('cms.urls')), ) if settings.DEBUG: urlpatterns = patterns('', (r'^' + settings.MEDIA_URL.lstrip('/'), include('appmedia.urls')), ) + urlpatterns </code></pre> <p>I have restarted the server as was mentioned in the tutorial, but no success. Any ideas as to what is wrong with my simple app?!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload