Forums

Django 404 problem

Hi,

I'm trying to deploy my django 1.5.4 web to pythonanywhere.com. I clone the project from a svn server, and use manual config with virtualenv. After a while my web http://decomle.pythonanywhere.com/ run but I always get the 404 Page. In my PC the address http://127.0.0.1:8000/rango/ work well but http://decomle.pythonanywhere.com/rango/ does not.

Could anyone suggest why?

From the difference in the error between http://decomle.pythonanywhere.com/ (includes a url pattern for rango) and http://decomle.pythonanywhere.com/rango/ (does not include a url pattern for rango), it looks like there are no urls defined beneath /rango. Perhaps you have an include that isn't working the way you expect.

Dear glenn,

Thanks for your reply. I try to add "url(r'^$', views.index, name='index'), in rango/urls.py" and reloads the web. But it still doesn't work too. Can you take a look at my code?

rango/urls.py

 urlpatterns = patterns('',
    url(r'^$', views.index, name='index'),
    url(r'^about/$', views.about, name='about'),
    url(r'^add_category/$', views.add_category, name='add_category'),
    url(r'^category/(?P<category_id>\d+)/$', views.category, name='category'),
    url(r'^category/(?P<category_id>\d+)/add_page/$', views.add_page, name='add_page'),
    url(r'^register/$', views.register, name='register'),
    url(r'^login/$', views.user_login, name='login'),
    url(r'^logout/$', views.user_logout, name='logout'),
    url(r'^search/$', views.search, name='search'),
    url(r'^profile/$', views.profile, name='profile'),
    url(r'^goto/$', views.track_url, name='track_url'),
    url(r'^like_category/$', views.like_category, name='like_category'),
    url(r'^suggest_category/$', views.suggest_category, name='suggest_category'),
    url(r'^my_cv/$', views.my_cv, name='my_cv'),
)

tango_with_django_project/urls.py

urlpatterns = patterns('',
    url(r'^rango/', include('rango.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

I think you have two different folders called "rango" on your sys.path, and one of them is shadowing the other. Remove the one you're not using?

Oh thanks harry. It's the problem. I have 1 rango folder in /home/decomle and 1 in /home/decomle/tango_with_django_project. I deleted the /home/decomle/rango and it's worked like charming. Thank you very much. It was very helpful.

And I'm really sorry about the late response. The timezone is difference here!

no problem, glad it's working :)