Hi Selena, To avoid this problem and make your app relocable, you should not use hard coded paths. Here's what I use on my projects:
from os import path rel = lambda *x: path.join(path.abspath(path.dirname(__file__)), *x) DATABASE_NAME = rel('dev.db') MEDIA_ROOT = rel('media') TEMPLATE_DIRS = (rel('templates'), ) David On Mon, Oct 19, 2009 at 9:16 PM, selena <idealnig...@gmail.com> wrote: > > hello everyone > i apologize for being so quick on asking for help, before i double > checked my paths and local settings - which i thought i did but.... > i have just realized that i had the old computer's name SSAVIC in the > database_name path - and that was the only reason this was not > working! thanks for help, this is (self)resolved > s > > On Oct 19, 5:15 pm, selena <idealnig...@gmail.com> wrote: >> sure, here it is: >> >> # Django settings for mysite project. >> >> DEBUG = True >> TEMPLATE_DEBUG = DEBUG >> >> ADMINS = ('selena', 'idealnig...@gmail.com' >> # ('Your Name', 'your_em...@domain.com'), >> ) >> >> MANAGERS = ADMINS >> >> DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', >> 'postgresql', 'mysql', 'sqlite3' or 'oracle'. >> DATABASE_NAME = '/home/ssavic/django2/mysite/db.db' # Or >> path to database file if using sqlite3. >> DATABASE_USER = '' # Not used with sqlite3. >> DATABASE_PASSWORD = '' # Not used with sqlite3. >> DATABASE_HOST = '' # Set to empty string for localhost. >> Not used with sqlite3. >> DATABASE_PORT = '' # Set to empty string for default. Not >> used with sqlite3. >> >> # Local time zone for this installation. Choices can be found here: >> #http://en.wikipedia.org/wiki/List_of_tz_zones_by_name >> # although not all choices may be available on all operating systems. >> # If running in a Windows environment this must be set to the same as >> your >> # system time zone. >> TIME_ZONE = 'Europe/Amsterdam' >> >> # Language code for this installation. All choices can be found here: >> #http://www.i18nguy.com/unicode/language-identifiers.html >> LANGUAGE_CODE = 'en-us' >> >> SITE_ID = 1 >> >> # If you set this to False, Django will make some optimizations so as >> not >> # to load the internationalization machinery. >> USE_I18N = True >> >> # Absolute path to the directory that holds media. >> # Example: "/home/media/media.lawrence.com/" >> MEDIA_ROOT = '' >> >> # URL that handles the media served from MEDIA_ROOT. Make sure to use >> a >> # trailing slash if there is a path component (optional in other >> cases). >> # Examples: "http://media.lawrence.com", "http://example.com/media/" >> MEDIA_URL = '' >> >> # URL prefix for admin media -- CSS, JavaScript and images. Make sure >> to use a >> # trailing slash. >> # Examples: "http://foo.com/media/", "/media/". >> ADMIN_MEDIA_PREFIX = '/media/' >> >> # Make this unique, and don't share it with anybody. >> SECRET_KEY = 'c...@oss_^es%rz3&xaxc$3lap6jp0h0bq=mf=1r1kg3z...@_wv' >> >> # List of callables that know how to import templates from various >> sources. >> TEMPLATE_LOADERS = ( >> 'django.template.loaders.filesystem.load_template_source', >> 'django.template.loaders.app_directories.load_template_source', >> # 'django.template.loaders.eggs.load_template_source', >> ) >> >> MIDDLEWARE_CLASSES = ( >> 'django.middleware.common.CommonMiddleware', >> 'django.contrib.sessions.middleware.SessionMiddleware', >> 'django.contrib.auth.middleware.AuthenticationMiddleware', >> ) >> >> ROOT_URLCONF = 'mysite.urls' >> >> TEMPLATE_DIRS = ( >> # Put strings here, like "/home/html/django_templates" or "C:/www/ >> django/templates". >> # Always use forward slashes, even on Windows. >> # Don't forget to use absolute paths, not relative paths. >> '/home/ssavic/django2/mysite/templates' >> ) >> >> INSTALLED_APPS = ( >> 'django.contrib.auth', >> 'django.contrib.contenttypes', >> 'django.contrib.sessions', >> 'django.contrib.sites', >> 'mysite.polls', >> 'django.contrib.admin' >> ) >> >> i suspect the sqlite version and folder structure not working with the >> newer version of python. but maybe this is just a very unexperienced >> opinion. >> thanks for help! >> selena >> >> On Oct 19, 5:51 am, Ovnicraft <ovnicr...@gmail.com> wrote: >> >> > 2009/10/18 selena <idealnig...@gmail.com> >> >> > > Hello >> > > hey michael >> > > I have been experiencing this problem since I installed my brand new >> > > Ubuntu Karmic with python in version 2.6 The project I am working on >> > > was working under python2.5 in my old Gentoo and still works (at least >> > > the python manage.py syncdb command does) on a server which is also >> > > running python2.5. >> > > I have tried installing both the latest official version and the >> > > latest development version of django and still the >> > > "python manage.py syncdb" >> > > it returns this error: >> >> > > Traceback (most recent call last): >> > > File "manage.py", line 11, in <module> >> > > execute_manager(settings) >> > > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ >> > > __init__.py", line 3 >> > > utility.execute() >> > > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ >> > > __init__.py", line 3 >> > > self.fetch_command(subcommand).run_from_argv(self.argv) >> > > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ >> > > base.py", line 195, >> > > self.execute(*args, **options.__dict__) >> > > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ >> > > base.py", line 222, >> > > output = self.handle(*args, **options) >> > > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ >> > > base.py", line 351, >> > > return self.handle_noargs(**options) >> > > File "/usr/local/lib/python2.6/dist-packages/django/core/management/ >> > > commands/syncdb.py", >> > > cursor = connection.cursor() >> > > File "/usr/local/lib/python2.6/dist-packages/django/db/backends/ >> > > __init__.py", line 81, i >> > > cursor = self._cursor() >> > > File "/usr/local/lib/python2.6/dist-packages/django/db/backends/ >> > > sqlite3/base.py", line 1 >> > > self.connection = Database.connect(**kwargs) >> > > sqlite3.OperationalError: unable to open database file >> >> > > i have looked at other posts and the majority of people had >> > > the"operational error" caused by "~" in the path to the main folder in >> > > the settings.py or permissions to write for the folder that contains >> > > the project. none of the advices i found solved my problem. >> > > do you have any idea where this comes from and what should i do? is >> > > there something to be set in sqlite or should i modify django's >> > > destinations/target files? >> > > thanks >> >> > could you post your settings.py file? >> >> > > selena >> >> > -- >> > Cristian Salamea >> > CEO GnuThink Software Labs >> > Software Libre / Open Source >> > (+593-8) 4-36-44-48 > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---