Thanks all. Just getting up to speed on regex, need to re-read some chapters. Changing these to the suggested above, fixing the mismatched from "mysite.views import hello" by importing * in the urls.py and removing the quotes around the func got me to my targeted basic site. Best, V.
On Sunday, September 23, 2012 4:54:46 PM UTC-5, JirkaV wrote: > > Hi Vincent, > > Django is telling you what the problem is - none of strings in urls.py > matches the requested URL. All lines in your file say that the regular > expression fas nothing before the "foo" (the "^" character says that). > However the URL you are trying has "homepage/" before "foo". Hence it does > not match. > > You need to correct this before you can proceed furter. Either remove the > "homepage/" from your request (may be in a link on your first page) or > change the urls.py accordingly. > > HTH > > Jirka > ------------------------------ > *From: * Vincent Fulco <vfu...@gmail.com <javascript:>> > *Sender: * django...@googlegroups.com <javascript:> > *Date: *Sun, 23 Sep 2012 12:47:39 -0700 (PDT) > *To: *<django...@googlegroups.com <javascript:>> > *ReplyTo: * django...@googlegroups.com <javascript:> > *Subject: *Re: Beginner problem linking pages from homepage? > > Thank you for the timely advice. Before I move my "base/homepage" site to > its own app dir, thought I would give it another pass using your changes. > Verified 'mysite.urls' in settings.py, added 'mysite' to the urlpatterns > arg and put quotes around the hello func. I have had debugging from the > outset of installation. views.py in the mysite/mysite dir is simply: > > def hello(request): > return HttpResponse('Hello World!') > > The 404 error which comes up is: > > Page not found (404) Request Method: GET Request URL: > http://192.168.1.126:8000/homepage/foo1 > > Using the URLconf defined in mysite.urls, Django tried these URL > patterns, in this order: > > 1. ^foo1$ > 2. ^foo2$ > 3. ^foo3$ > 4. ^foo4$ > > The current URL, homepage/foo1, didn't match any of these. > > You're seeing this error because you have DEBUG = True in your Django > settings file. Change that to False, and Django will display a standard > 404 page. Could be a permissions thing or some subtle backslashes nuance I > haven't picked up on yet? > Thanks again. V. > > > On Saturday, September 22, 2012 7:39:36 PM UTC-5, Sam Lai wrote: >> >> >> >> I just created a toy project with that urls.py and it worked fine. >> >> > I am not even sure if philosophically this is considered a good >> practice of >> > django. Thanks in advance for your assistance. V. >> >> Generally you would not create a views.py in your project directory >> (mysite/mysite is your project directory). You would usually create an >> app (mysite/manage.py startapp appname), create your views, app-level >> URLs, models etc. in there, and then reference them in your project >> urls.py by including your app's urls.py. >> >> Also, generally you would reference the view using a string, instead >> of the actual view function itself. This saves you from having to >> import every view, and avoid clashes in larger projects where you may >> have view functions with the same name in different apps. In the >> second urls.py you posted, the first parameter to patterns, where you >> have 'homepage' specified, is used to shorten these view function >> strings - that parameter is appended to your url definitions, i.e. you >> could use the following urls.py instead - >> >> urlpatterns = patterns('mysite', >> url(r'^foo1$', 'hello'), >> url(r'^foo2$', 'hello'), >> url(r'^foo3$', 'hello'), >> url(r'^foo4$', 'hello'), >> ) >> >> ... and Django will append 'mysite' to all the view function strings, >> turning them into 'mysite.hello'. See >> https://docs.djangoproject.com/en/dev/topics/http/urls/#the-view-prefix >> >> > >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "Django users" group. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msg/django-users/-/ojFywQSzpYsJ. >> > To post to this group, send email to django...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users...@googlegroups.com. >> > 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 view this discussion on the web visit > https://groups.google.com/d/msg/django-users/-/_y5eEwalYc8J. > To post to this group, send email to django...@googlegroups.com<javascript:> > . > To unsubscribe from this group, send email to > django-users...@googlegroups.com <javascript:>. > 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 view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/OIDslgsyLxYJ. 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.