if i do that i get this error 'module' object has no attribute 'current_datetime'
On Jun 13, 8:10 pm, David Escobar <davidesco...@ieee.org> wrote: > Or you may not even need the mysite part of the import: > > import views > > urlpatterns = patterns('', > ('^time/$', views.current_datetime), > > On Sun, Jun 13, 2010 at 5:06 PM, David Escobar <davidesco...@ieee.org>wrote: > > > > > 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 <joshua.matl...@comcast.net>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 django-us...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/django-users?hl=en.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.