On Apr 18, 8:47 pm, asherakhet06 <francisco.demira...@gmail.com> wrote: > H all! > > I am fairly new to programming (went over LPTHW) and now going through the > Djangobook on the internet. Quick beginners question: In Chapter 3, where > I am looking at a dynamic webpage in the 2nd example
Could you please post a link to this resource ? > I am running into some > problems with the current_datetime function I am trying to set up. When, in > views.py I insert the "datetime.datetime.now()" statement and "import > current_datetime" into my urls.py file If your import statement is actually "import current_datetime", then the book is wrong, Python imports dont work that way. You either import a module then use a qualified name to access the module's symbols, ie: from myapp import views now = views.current_datetime() or import a symbol from a module and use it directly, ie: from myapp.views import current_datetime now = current_datetime() of course the module (or the package containing the module) must be in your pythonpath. for more about the import statement, see * http://docs.python.org/release/2.7/tutorial/modules.html and * http://docs.python.org/release/2.7/reference/simple_stmts.html#the-import-statement > but it's been > a real puzzle for me to be honest:/ Anybody have any tips on how to solve > this error? I know it is really important to be careful to copy EXACTLY as > mentioned in the programming book(s), Books are sometimes wrong, and sometimes a bit outdated. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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.