You need to import your views and reference the callable as described at 
https://docs.djangoproject.com/en/stable/topics/http/urls/#example.

Referencing the view by string using patterns() is deprecated:
https://docs.djangoproject.com/en/stable/releases/1.8/#django-conf-urls-patterns

On Friday, February 19, 2016 at 8:55:44 AM UTC-5, [email protected] 
wrote:
>
> Hi there. To test out django I created a Work_manager for a site, and 
> created this for he urls.py:
>
> from django.conf.urls import include, url
>  # from django.contrib import admin
>
> urlpatterns = [
>    # url(r'^admin/', admin.site.urls),
>     url(r'^$', 'TasksManager.views.index.page'),
>     url(r'^index$', 'TasksManager.views.index.page')
> ]
>
> In the TasksManager/views/index.py:
>
> # - * - Coding: utf -8 - * -
> from django.http import HttpResponse
> # View for index page.
> def page(request):
> return HttpResponse("Testing...")
>
> Yet when I run the program: python manage.py runserver 127.0.0.1:8000 I 
> get the response: 
>
> Unhandled exception in thread started by <function wrapper at 
> 0x7f4cd2aaf410> 
> Traceback (most recent call last): 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/utils/autoreload.py",
>  
> line 226, in wrapper 
>    fn(*args, **kwargs) 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/core/management/commands/runserver.py",
>  
> line 116, in inner_run 
>    self.check(display_num_errors=True) 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/core/management/base.py",
>  
> line 366, in check 
>    include_deployment_checks=include_deployment_checks, 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/core/checks/registry.py",
>  
> line 75, in run_checks 
>    new_errors = check(app_configs=app_configs) 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/core/checks/urls.py",
>  
> line 13, in check_url_config 
>    return check_resolver(resolver) 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/core/checks/urls.py",
>  
> line 23, in check_resolver 
>    for pattern in resolver.url_patterns: 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/utils/functional.py",
>  
> line 35, in __get__ 
>    res = instance.__dict__[self.name] = self.func(instance) 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/urls/resolvers.py",
>  
> line 297, in url_patterns 
>    patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module) 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/utils/functional.py",
>  
> line 35, in __get__ 
>    res = instance.__dict__[self.name] = self.func(instance) 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/urls/resolvers.py",
>  
> line 290, in urlconf_module 
>    return import_module(self.urlconf_name) 
>  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in 
> import_module 
>    __import__(name) 
>  File "/home/benedict/Work_manager/Work_manager/urls.py", line 21, in 
> <module> 
>    url(r'^$', 'TasksManager.views.index.page'), 
>  File 
> "/usr/local/lib/python2.7/dist-packages/Django-1.10.dev20160212033127-py2.7.egg/django/conf/urls/__init__.py",
>  
> line 85, in url 
>    raise TypeError('view must be a callable or a list/tuple in the case of 
> include().') 
> TypeError: view must be a callable or a list/tuple in the case of 
> include().
>
>
> Some help would be much appreciated.
>
> Ruben
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ad6e60d6-47f4-4ff7-a22e-b50d66bc50fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to