Forums

Page not found at /

Hello!! i am a beginner in django development and has been studying the book "how to tango with django 17".. i have created my first web app and when i tried to run it i got this error: "Page not found at/".i understand that it's an error related to my urls.py file of my app..but the thing is how should i map my pythonAnywhere domain name to the index page of my web app..the web app is currently running a different index page, that is just a basic login page..the error says it "could not find this url :http://pravarag.pythonanywhere.com/"..can anybody help, please?

You don't need to do anything to map the PythonAnywhere domain name, your Django app runs there, so the urls.py is only for the stuff that comes after the http://pravarag.pythonanywhere.com in the url. The issue that you're facing is that you haven't defined a url for /, all of your urls are for either /admin/ or /imdbApp/ (you can see that in the error message).

okk..i checked the error logs but for the current error they show nothing..so, my current application's url file is like this:

from django.conf.urls import patterns, url
from imdbApp import views

urlpatterns=patterns('',
    url(r'^$', views.user_login, name='login'),
    url(r'^logout/$', views.user_logout, name='logout'),
    url(r'^register/$', views.register, name='register'),
    url(r'^dashboard/$', views.dashboard, name='dashboard'),
    url(r'^movie_search/$', views.movie_search, name='movie_search'),
    url(r'^movie_info/$', views.movie_search, name='movie_info'),
)

so should i edit it to like this:

from django.conf.urls import patterns, url
from imdbApp import views
 urlpatterns=patterns('',
    url(r'^/$', views.user_login, name='login'),
    url(r'^logout/$', views.user_logout, name='logout'),
    url(r'^register/$', views.register, name='register'),
    url(r'^dashboard/$', views.dashboard, name='dashboard'),
    url(r'^movie_search/$', views.movie_search, name='movie_search'),
    url(r'^movie_info/$', views.movie_search, name='movie_info'),
)

but i tried this pattern and it didn't work..also, did you mean to edit my project's url file which is:

 from django.conf.urls import patterns, include, url
 from django.contrib import admin

 urlpatterns = patterns('',
   # Examples:
          # url(r'^$', 'imdb_project.views.home', name='home'),
          # url(r'^blog/', include('blog.urls')),

             url(r'^admin/', include(admin.site.urls)),
             url(r'^imdbApp/', include('imdbApp.urls')),

      )

plz help me here, thanks!!

It looks like that would work if you hadn't commented out the 'imdb_project.views.home' url.

hey, i tried by removing the comments from the statement you mentioned but it still not works..i then changed the whole project and cloned one of the copies of an existing project of the book i'm currently learning from..it still shows the same error..can you plz help me?

In this list that is displayed in the error message

^admin/
^rango/
^accounts/register/$ [name='registration_register']
^accounts/
media/(?P<path>.*)

There is no root URL defined. If you go to /rango/ you'll see a page and there's one at /accounts/register/ and many others, but there isn't a URL defined for /, so there is no page there.

Hey thanks, i finally made the changes and now it works all perfect..i'm sorry i bugged you for a little longer, but that's how we learn, right? so thanks again, and it's really great to be a part of pythonanywhere.com...

Excellent, thanks for confirming it works :-)