Search code examples
djangogoogle-app-engineurlconf

URLConf that works on development server but not on GAE


I am using Django non-rel in Google App Engine, and my URLConf seems not to work and generate a 500 Server Error.

This is my urls.py file at the root of my app :

from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
    url(r'^home/', include('appname.home.urls')),
)

And this is my urls.py in a subpackage home of appname:

from django.conf.urls import patterns, include, url
urlpatterns = patterns(r'appname.home.views',
    url(r'^0/', 'home'),
)

It works great in development server but it does not work on Google App Engine.

I already read a related question and its answer but it did not solve my problem.


Solution

  • What does the error message say in the logs? You urlpatterns is malformed. The first r'' is incorrect. That should be a string. And, is the 0 in your url intentional? Change to:

    urlpatterns = patterns('appname.home.views',
        url(r'^$', 'home'), # matches mysite.com
        url(r'^0/$', 'home'), # matches mysite.com/0/
    )