In your urls.py try doing a straight import instead of the from module
import function version:
import mysite.views
urlpatterns = patterns('',
('^time/$', mysite.views.current_datetime),
...doesn't seem like it should make a difference, but it's worth a shot...
On Sun, Jun 13, 2010 at 4:52 PM, JRMAbock <[email protected]>wrote:
> I have enter the code in correctly,
> views.py:
>
> from django.http import HttpResponse
> import datetime
>
> def current_datetime(request):
> now = datetime.datetime.now()
> html = "<html><body>It is now %s.</body></html>" % now
> return HttpResponse(html)
> urls.py:
>
> from django.conf.urls.defaults import *
> from mysite.views import current_datetime
>
>
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
> ('^time/$', current_datetime),
>
>
> # Example:
> # (r'^mysite/', include('mysite.foo.urls')),
>
> # Uncomment the admin/doc line below and add
> 'django.contrib.admindocs'
> # to INSTALLED_APPS to enable admin documentation:
> (r'^admin/doc/', include('django.contrib.admindocs.')),
>
> # Uncomment the next line to enable the admin:
> (r'^admin/', include(admin.site.urls)),
> )
>
> I continue to recieve this error:
> cannot import name current_datetime
>
> Please help me solve this problem because I cannot continue until I do.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<django-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.