hello , you forgot to add the library in urls.py *from django.conf.urls import patterns, include, url*
Le jeudi 8 août 2013 08:53:14 UTC+1, goreano a écrit : > > 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* > > * * *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 > > BASE_DIR = os.path.dirname(os.path.abspath(__file__)) > > DEBUG = True > TEMPLATE_DEBUG = DEBUG > > ADMINS = ( ) > > MANAGERS = ADMINS > > DATABASES = { > 'default': { > 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', > 'mysql', 'sqlite3' or 'oracle'. > 'NAME': 'polls', # Or path to database file > if using sqlite3. > # The following settings are not used with sqlite3: > 'USER': 'django', > 'PASSWORD': 'password', > 'HOST': '', # Empty for localhost through > domain sockets or '127.0.0.1' for localhost through TCP. > 'PORT': '', # Set to empty string for default. > } > } > > ALLOWED_HOSTS = [] > > TIME_ZONE = 'Europe/Madrid' > > > LANGUAGE_CODE = 'en-us' > > SITE_ID = 1 > > USE_I18N = True > > > USE_L10N = True > > USE_TZ = True > > MEDIA_ROOT = '' > > MEDIA_URL = '' > > STATIC_ROOT = '' > > STATIC_URL = '/static/' > > STATICFILES_DIRS = () > > > STATICFILES_FINDERS = ( > 'django.contrib.staticfiles.finders.FileSystemFinder', > 'django.contrib.staticfiles.finders.AppDirectoriesFinder', > # 'django.contrib.staticfiles.finders.DefaultStorageFinder', > ) > > > SECRET_KEY = 'xxxxx' > # List of callables that know how to import templates from various sources. > TEMPLATE_LOADERS = ( > 'django.template.loaders.filesystem.Loader', > 'django.template.loaders.app_directories.Loader', > # 'django.template.loaders.eggs.Loader', > ) > > MIDDLEWARE_CLASSES = ( > 'django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware', > # Uncomment the next line for simple clickjacking protection: > # 'django.middleware.clickjacking.XFrameOptionsMiddleware', > ) > > ROOT_URLCONF = 'mysite.urls' > > # Python dotted path to the WSGI application used by Django's runserver. > WSGI_APPLICATION = 'mysite.wsgi.application' > > TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')] > > > INSTALLED_APPS = ( > 'django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'django.contrib.messages', > 'django.contrib.staticfiles', > # Uncomment the next line to enable the admin: > 'django.contrib.admin', > # Uncomment the next line to enable admin documentation: > #'django.contrib.admindocs', > 'polls' > ) > > > LOGGING = { > 'version': 1, > 'disable_existing_loggers': False, > 'filters': { > 'require_debug_false': { > '()': 'django.utils.log.RequireDebugFalse' > } > }, > 'handlers': { > 'mail_admins': { > 'level': 'ERROR', > 'filters': ['require_debug_false'], > 'class': 'django.utils.log.AdminEmailHandler' > } > }, > 'loggers': { > 'django.request': { > 'handlers': ['mail_admins'], > 'level': 'ERROR', > 'propagate': True, > }, > } > } > > > #DJANGO_SETTINGS_MODULE = 'mysite.settings'* > > > > > > this is the site urls file > *from django.conf.urls import patterns, include, url* > *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') > )* > > > Thanks!!!!! > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. For more options, visit https://groups.google.com/groups/opt_out.

