“Site matching query does not exist” with djangoappengine & pydev

This has been driving me nuts all morning.  When trying to direct a login request to django.contrib.auth.views.login I get: Site matching query does not exist.  Other requests work ok…

All solutions I found related to the fact that the SITE_ID in settings.py did not match the id of the object in the database.  However, after manually verifying these were identical, trying to manually remove/add new site objects, flushing both the django and appengine datastores, it still would not work…

Up to then I was always starting the appengine server through pydev.  However, I was always running manage.py through a commandline prompt (to check the datastore).  Turns out that if I als run the server from the commandline (so not from pydev) and make sure the id’s match, it does work correctly!

Turns running from the commandline or pydev results in using a different database file (on windows at least, still need to test in linux). Running from the commandline creates files in .gaedata while pydev creates files in the users tmp directory.

Update: Turns out it was something silly.  In pydev my project was configured as a google appengine run, while it should have been a djangor run (django-nonrel will not work properly if you invoke the appengine server directly)

–Dirk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s