django "Exception Value: No module named urls" for admin site
Question: I am django newbie , trying to follow a tutorial. When I am trying to access
django administration site

    
    
            http://127.0.0.1:8000/admin/
    

it giving the error "Exception Value: No module named urls" for the below code

    
    
        #uls.py
        from django.conf.urls import *
        from mysite.views import *
        # Uncomment the next two lines to enable the admin:
    
        # from django.contrib import admin
        # admin.autodiscover()
        #TODO ADD LIST OF URL
        urlpatterns = patterns('',
            (r'^home\/?$',get_homepage),
            (r'^admin\/?$',include('django.contrib.admin.urls')),
        )
    

I have tried multiple solution aviable on stackover flow @last publishing the
issue get it resolved

    
    
        #settings.py
        ROOT_URLCONF = 'mysite.urls'
        # Python dotted path to the WSGI application used by Django's runserver.
        WSGI_APPLICATION = 'mysite.wsgi.application'
        TEMPLATE_DIRS = (
            '/home/abuzzar/djcode/mysite/mysite/template',
            # Put strings here, like "/home/html/django_templates" or                 "C:/www/django/templates".
                # Always use forward slashes, even on Windows.
                # Don't forget to use absolute paths, not relative paths.
            )
    
            INSTALLED_APPS = (
                'django.contrib.auth',
                'django.contrib.contenttypes',
                #'django.contrib.sessions',
                #'django.contrib.sites',
                #'django.contrib.messages',
                #'django.contrib.staticfiles',
                'mysite.jobpost',
                'django.contrib.admin',
                # Uncomment the next line to enable the admin:
                # 'django.contrib.admin',
                # Uncomment the next line to enable admin documentation:
                # 'django.contrib.admindocs',
            )
    

error : <http://pastebin.com/RMvzPd61>

i tried the solution : [Django 1.5.1 'ImportError: No module named urls' when
running
tests](http://stackoverflow.com/questions/15758494/django-1-5-1-importerror-
no-module-named-urls-when-running-tests) but did not worked.


Answer: To [include admin
urls](https://docs.djangoproject.com/en/dev/ref/contrib/admin/#hooking-
adminsite-instances-into-your-urlconf), use this:

    
    
    from django.contrib import admin
    
    admin.autodiscover()
    
    urlpatterns = patterns('',
        (r'^admin/', include(admin.site.urls)),
    )
    

Or, to fix your issue, add `site` between `admin` and `urls`

    
    
    (r'^admin\/?$',include('django.contrib.admin.site.urls'))
    

On a general note, I would revisit the URL pattern. `^admin\/?$` should not
have the `$` at the end since you are including another url conf.

Also, `^admin/` should be sufficient

