Something on our host was driving me crazy for hours yesterday.  

after deploying to mysite.com/directory, when I followed a link (say about-us) it would take me to mysite.com/about-us instead of mysite.com/directory/about-us.

I thought it might be related to the Site settings and even tried the shell:

 >>> from django.contrib.sites.models import Site
 >>> Site.objects.get_current().domain 


but that returned mysite.com/directory.

Fortunately support at webfaction is pretty quick and smart and they pointed us to a variable in the settings file.  If you’re having that same problem just add:

#settings.py
FORCE_SCRIPT_NAME = "/directory"

(with no forward slash)

Maybe you’re testing your site, maybe you want to leave it in the Deep Web …

in any case if you want to display a “radioactive!!, do not index” sign for search engines you need a robots.txt file at the root of your directory.  

solar robot

So if your site is mysecretsite.com, you want it to be at

mysecretsite.com/robots.txt

To ban all access simply copy paste this in your file,

User-agent: *
Disallow: /
then inside the apache2 edit the httpd.conf file with:
LoadModule alias_module modules/mod_alias.so 
<Location "/robots.txt"> 
SetHandler None 
</Location> 
alias /robots.txt /home/myusername/webapps/mywsgiapp/some-directory/robots.txt 
restart the apache server, and you’re done.

For the first time, the tech support at @ my host (webfaction ) feels like I’ve said “Shibboleet!”

  • alvaro: dude, .bash_profile adding, > export PYTHONPATH="/home/username/webapps/app_production/lib/python2.7/:$PYTHONPATH"
  • hannes: I already have this in my bash_profile. What about tail -f error_django_app.log
  • alvaro: hum, 2.24.223.4 - - [13/Apr/2012:10:49:37 +0200] "GET / HTTP/1.0" 500 538 "-" "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:11.0) Gecko/20100101 Firefox/11.0" and the error [Fri Apr 13 10:49:41 2012] [error] [client 127.0.0.1] os.environ['DJANGO_SETTINGS_MODULE'] = 'someapp.settings' activate_this
  • hannes: have you had this error? 'Try setting GEOIP_LIBRARY_PATH in your settings.' % lib_name)
  • [Fri Apr 13 11: 27:56 2012] [error] [client 127.0.0.1] GeoIPException: Could not find the GeoIP library (tried "GeoIP"). Try setting GEOIP_LIBRARY_PATH in your settings.
  • alvaro: man, it's late
  • hannes: ok. good night.
  • alvaro: good night.