1

I am new to Django. I am following the instructions given in the tutorial. When I am running python manage.py syncdb, I am getting the following error:

D:\MyDev\DjnagoProject\mysite>python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 9, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 420, in execute_from_command_
line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "C:\Python27\lib\site-packages\django\core\management\commands\syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "C:\Python27\lib\site-packages\django\db\backends\dummy\base.py", line 15, in complain
    raise ImproperlyConfigured("You haven't set the database ENGINE setting yet.")
django.core.exceptions.ImproperlyConfigured: You haven't set the database ENGINE setting yet.

Adding information : Python version : 2.7.2, django version : (1, 4, 0, 'alpha', 1) OS : windows XP

Please let me know where I am making a mistake.

3
  • I don't know which tutorial you are following but the official tutorial clearly mentions to setup database engine first and than run python manage.py syncdb. Commented May 21, 2012 at 10:46
  • I am also following the same document which you have mentioned here. this is database value which i have modified as per my requirement in setting.py file DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': r'D:/MyDev/DjnagoProject/mysite/myDev.db', # Or path to database file if using sqlite3. Commented May 21, 2012 at 10:59
  • Show us the content of settings.py file relevant to the database section. And also which database you are using I suggest you use sqlite3 which is in-built for python >2.5 Commented May 21, 2012 at 11:00

5 Answers 5

5

Read your error messages:

ImproperlyConfigured: You haven't set the database ENGINE setting yet.

Check DATABASES in your settings.py. You need at least ENGINE and database NAME

Sign up to request clarification or add additional context in comments.

4 Comments

it's either not loading your settings or you have not set the database engine setting.
can you please suggest what should i do? As i have tried to set PYTHONPOATH as well but no result. It will be great if you can suggest some alternative..
@vartec: Isn't these things happen by default when you do pip install django. It happened for me
Do i need to setup PythonPath or DJANGO_SETTINGS_MODULE path in my system environment?
1
You haven't set the database ENGINE setting yet.

Make sure you have correct DB credentials in settings.py.

Comments

1

you need to do following two things in settings.py

  1. add database engine and credentials in database dictionary.
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqllite3',
        'NAME': '/home/yourname/mydb', 
        'USER': '',   
        'PASSWORD': '',  
        'HOST': '',        
        'PORT': '',  
}
}
  1. add your app to installed_app list
INSTALLED_APPS = (
    'com.example.myapp',
    ....

1 Comment

I am still getting the same error. DATABASES = { 'default': { 'ENGINE':"sqlite3", 'NAME':r"D:/MyDev/DjnagoProject/mysite/myDev.db", 'USER':'', 'PASSWORD':'', 'HOST':'', 'PORT':'', } } INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'mysite.blog', ) I have created blog application inside the mysite.
1

I addition to database configuration in settings.py file:

Now on Django 1.8.x, it fully supports migrations.

syncdb will be fully removed in version 1.9

Try to use makemigrations and migrate instead

python manage.py makemigrations app1 app2 app3

will make migration scripts in each app migration folder

python manage.py migrate

Will look at database django_migrations table and migrations folder and will migrate the changes.

Comments

0

Install MySQL-python worked for me!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.