#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    26
    Rep Power
    0

    Can't create database (.db) file in Django Tutorial


    I'm using sqlite3 and and after I python manage.py syncdb it's supposed to create a database file (called sqlite3.db) It doesn't do this. I've tried searching for the file and I've tried running all the commands as Administrator and normal user. No luck so far.

    What's going wrong here? I would reallly appreciate some help here!

    Here's the Traceback:

    Traceback (most recent call last):
    File "manage.py", line 14, in <module>
    execute_manager(settings)
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 56, in handle_noargs
    cursor = connection.cursor()
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 250, in cursor
    cursor = self.make_debug_cursor(self._cursor())
    File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 201, in _cursor
    raise ImproperlyConfigured("Please fill out the database NAME in the settings module before using the database.")
    django.core.exceptions.ImproperlyConfigured: Please fill out the database NAME in the settings module before using the database.

    Btw I'm not using the latest Django. I'm using Django 1.3
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    26
    Rep Power
    0

    I solved this now!


    In order to create the database file you have to write the full absolute path to the database file you want to create. You write the full absolute path with the database file you want to create as part of the path. e.g. from settings.py > 'NAME': '/home/yourusername/Dokumenter/Django/mysite/sqlite3.db',

    I was assuming it would be created and then, I could add it to settings.py. But it was the other way around! I guess I kind of suck at this! LOL

IMN logo majestic logo threadwatch logo seochat tools logo