How (if it is possible) can set up a route in Django that would point a certain url to a non-django script? E.g. I’d like to have /independent handled by a very simple CGI script such as this one:
import os
print 'Status: 200 OK'
print 'Content-type: text/html'
print
for key, value in os.environ.items():
print key, ': ', value, '<br/>'
I’m not a Django user (yet, I.. think, it’s upon me) and just need a way to hack this little detour into an application. So: is this possible? If yes, how?
Not directly. All Django urls have to go to a Django view, a callable which accepts a request and returns a response.
You can though return a redirect[1] to an arbitrary urls. So you should be able to write a very simple wrapper view to do what you want.
[1] https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#examples