Skip to content

Instantly share code, notes, and snippets.

@ericmoritz
Created August 27, 2012 18:14
Show Gist options
  • Save ericmoritz/3491001 to your computer and use it in GitHub Desktop.
Save ericmoritz/3491001 to your computer and use it in GitHub Desktop.
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "relux.settings.local")
import inspect
from django.conf import settings
from django.core import urlresolvers
urlconf = settings.ROOT_URLCONF
urlresolvers.set_urlconf(urlconf)
resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)
url = "/"
callback, callback_args, callback_kwargs = resolver.resolve(url)
# The filename of the module that the view is defined in
view_filename = inspect.getsourcefile(callback)
print "%s:%s" % (view_filename, callback.__name__)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment