On 8/08/2013 5:53pm, goreano wrote:
> Hi,
>
> I'm a newbie diving into django I've found a problem I've been hitting
> my head against for the last 2 days.
>
> I think it is a path issue, actually I get the same error as i try to
> open any URL on localhost:8000
>
> Can you please give me a hint... I have to improve my path definition
> skills but I'm stuck here:
>
> I get an error:
> /
> /
>
>
> /ImportError at //
>
> //
>
> /No module named url/
This is the clue ... see below in your settings the ROOT_URLCONF value
which is where Django looks to see if the url sent by the browser can be
recognised (via matching to a Python regular expression) and if so,
which view code to execute.
So, that ROOT_URLCONF might include other named url modules (other
whatever.py files with (url matching to view) urls you want to satisfy.
By convention ROOT_URLCONF points to urls.py in the same directory as
the settings.py file but it doesn't have to.
If you are new to Django it can be somewhat confusing understanding the
paths involved. I found it valuable to print out all the paths if DEBUG
== True. Seeing them all permanently displayed by the dev server just
kept reminding me where they were and made debugging static file
locations and template dirs etc so easy.
Hth
>
> //
> /Request Method:/ /GET/
> /Request URL:/ /
http://localhost:8000//
> /Django Version:/ /1.5/
> /Exception Type:/ /ImportError/
> /Exception Value:/
>
> /No module named url/
>
> /Exception Location:/
> //usr/local/lib/python2.7/dist-packages/django/utils/importlib.py in
> import_module, line 35/
> /Python Executable:/ //usr/bin/python2.7/
> /Python Version:/ /2.7.3/
> /Python Path:/
>
> /['/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite',
> '/home/goreano/.eclipse/org.eclipse.platform_3.7.0_155965261/plugins/org.python.pydev_2.7.1.
2012100913/pysrc',
> '/home/goreano/Dropbox/formacion/Python/Django/proyectos/mysite',
> '/usr/local/lib/python2.7/dist-packages/ply-3.4-py2.7.egg',
> '/usr/lib/python2.7',
> '/usr/lib/python2.7/plat-linux2',
> '/usr/lib/python2.7/lib-tk',
> '/usr/lib/python2.7/lib-old',
> '/usr/lib/python2.7/lib-dynload',
> '/usr/local/lib/python2.7/dist-packages',
> '/usr/lib/python2.7/dist-packages',
> '/usr/lib/python2.7/dist-packages/PIL',
> '/usr/lib/python2.7/dist-packages/gst-0.10',
> '/usr/lib/python2.7/dist-packages/gtk-2.0',
> '/usr/lib/pymodules/python2.7',
> '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
> '/usr/lib/python2.7/dist-packages/ubuntuone-client',
> '/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
> '/usr/lib/python2.7/dist-packages/ubuntuone-couch',
> '/usr/lib/python2.7/dist-packages/ubuntuone-installer',
> '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol',
> '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode',
> '/usr/lib/python2.7/dist-packages/django']/
>
> /Server time:/ /Thu, 8 Aug 2013 09:34:16 +0200/
>
>
>
> this is my settings file
>
> /import os
> #DJANGO_SETTINGS_MODULE = 'mysite.settings'/
>
>
>
>
>
> this is the site urls file
>
> /from django.contrib import admin
> admin.autodiscover()
>
> # Uncomment the next two lines to enable the admin:
> # from django.contrib import admin
> # admin.autodiscover()
>
> urlpatterns = patterns('',
> # Examples:
> # url(r'^$', 'mysite.views.home', name='home'),
> # url(r'^mysite/', include('mysite.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'^polls/', include('polls.url'))
> )/
>
>
> and this the app urls file
>
>
> /from django.conf.urls import patterns, url
>
> from polls import views
>
> urlpatterns = patterns('',
> url(r'^$', views.index, name='index')
> )/