I’m in the middle of developing an app on Google’s App Engine, and one of the features is auth via Facebook Connect. I’ve got everything set up and working up to a certain level, but in order to test it against my dev machine, I’ve created a reverse proxy on one of my public facing servers that proxies through to the dev machine.
It all works fine except for most of the links are without the prefix I’ve created for the proxy.
So that got me thinking, is there an easy way to create a site-wide app prefix that not only works with my apps, but any 3rd party ones I want to use?
Is there some middleware I can include or a peice of the Django docs I’ve not read?
**Update: ** Following the comment below, the prefix I’m thinking of goes in between then the domain name and the app url:
Design the URLs for
myappto be standalone (such that its URLs can be ‘included’ in the URLs of another project).Notice that you’re not putting ‘myapp’ in your URLs at this point, but simply have a basic URL scheme that can be pointed wherever you want at deployment time.
Then, create a separate URLconf module for each target deployment (e.g., test vs. production) and use the
django.conf.urls.defaults.includefunction to wire up the URLs to whatever arbitrarily deep base URL you want:Point your deployment settings.py to use this URLconf module instead of pointing directly at the URL module for
myapp.Because my test environment looks quite different from my production environment, I like to have a separate settings module for each target deployment.