On Tue, 2009-01-06 at 15:12 -0800, rabbi wrote: [...] > i've now got it running on apache/mod_python too, but i had to > hardcode the entire path to the db file in settings.py: > "DATABASE_NAME = 'C:/Documents and Settings/Rabbi/Desktop/Django > Code/mysite/vocab'" > > is this really necessary or is there a nicer way that will work > anywhere?
Ah.. that change makes sense. SQLite is a nice database in some ways, and one of the things it does is not require you to create the database file ahead of time (it's created when you first access it, although it will be empty). The drawback is that if you misspell of mis-specify the database path in any way, a new file is created or accessed somewhere and will, indeed, be empty. Which is what you were seeing. You do need to specify the full path to the database file in your settings like the above. It's the only way the webserver can know where it is (your previous setting, whatever it was, happened to work by accident when you were using "runserver", since it was a relative path that just happened to be correct relative to where you were running from). Generally, the settings file for a project is one of the things you should expect to have to make small changes to as you move a collection of apps around between machines or installations. If you're careful, when developing, you should be able to set things up so that it's the *only* file you need to worry about tweaking and even possibly split it up into settings that are always valid and things like the above, path-sensitive value, that you know you need to change. Some people put the stuff they always need to change -- those settings which are machine-specific -- into a file called, say, local_settings.py and then, at the end of their settings.py, they write try: from local_settings import * except ImportError: pass The try...except is just in case you may not always have a local_settings file, but if you know it's always going to be there, you might leave out that try...except. Also, by putting this at the end, any local_settings values will override the previous settings values, which provides a good way to change things as well. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---