Problem with Django tutorial

1,094 views
Skip to first unread message

maxim

unread,
Apr 4, 2012, 12:51:39 PM4/4/12
to django...@googlegroups.com
I can't get the tutorial working for me. When I try to run the command:
python manage.py syncdb

I get this error:
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/usr/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "/usr/lib/python2.7/site-packages/django/db/backends/dummy/base.py", line 15, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

My settings file has this for databases:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '/home/maxim/mysite/mysite.db',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}


Joey Espinosa

unread,
Apr 4, 2012, 1:12:27 PM4/4/12
to django...@googlegroups.com
Are you using Django 1.4?
--
Joey "JoeLinux" Espinosa






--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/PPPfCQEQOKEJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

maxim

unread,
Apr 4, 2012, 1:15:26 PM4/4/12
to django...@googlegroups.com
Yes
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.

creecode

unread,
Apr 4, 2012, 1:19:13 PM4/4/12
to django...@googlegroups.com
Hello maxim,


On Wednesday, April 4, 2012 9:51:39 AM UTC-7, maxim wrote:

I can't get the tutorial working for me. When I try to run the command:
python manage.py syncdb
 
My settings file has this for databases:
 
        'NAME': '/home/maxim/mysite/mysite.db',                      # Or path to database file if using sqlite3.

I'm not sure but could it be there is no file at /home/maxim/mysite/mysite.db ?  If not you might try to touch that path and then try your syncdb.  It looks like are are on some kind of unix/linux variant so you probably have a touch command.

Toodle-looooooooooo......
creecode

creecode

unread,
Apr 4, 2012, 1:23:55 PM4/4/12
to django...@googlegroups.com
Opps...


On Wednesday, April 4, 2012 10:19:13 AM UTC-7, creecode wrote:

It looks like are are on some kind of unix/linux variant so you probably have a touch command.

That should have been "It looks like you are on..." 

maxim

unread,
Apr 4, 2012, 1:24:18 PM4/4/12
to django...@googlegroups.com
No, I tried removing the file, creating it with touch and I also used sqlite3 to create a table in there to make sure it actually has some database in there:
sqlite3 /home/maxim/mysite/mysite.db
SQLite version 3.6.23.1
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema
CREATE TABLE my_table (id int);

I still get that error in all cases.

Joey Espinosa

unread,
Apr 4, 2012, 1:24:20 PM4/4/12
to django...@googlegroups.com
Which settings.py file are you modifying? I had this problem at first too when I didn't read about Django's changes from 1.3 to 1.4. Here's an excerpt from  https://docs.djangoproject.com/en/1.4/releases/1.4/#updated-default-project-layout-and-manage-py :

Django 1.4 ships with an updated default project layout and manage.py file for the startproject management command. These fix some issues with the previous manage.py handling of Python import paths that caused double imports, trouble moving from development to deployment, and other difficult-to-debug path issues. 


manage.py
mysite/
    __init__.py
    settings.py
    urls.py
    myapp/
        __init__.py
        models.py
So basically, now there's a directory inside the project directory with the same name:

$ django-admin.py startproject example
$ ls
example/    __init__.py    manage.py    settings.py    urls.py
$ ls example/
__init__.py    settings.py    urls.py    views.py    wsgi.py

 The correct settings.py file you should use is NOT the one in the main project directory, it's the one INSIDE the directory that's created inside the project directory (the one I bolded). That's one major thing that's changed with this version of Django. The outer "settings.py" and "urls.py" shouldn't even exist, but for some reason they're being created anyway.


--
Joey "JoeLinux" Espinosa




To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/3ZDAMJucaLIJ.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.

Joey Espinosa

unread,
Apr 4, 2012, 1:25:19 PM4/4/12
to django...@googlegroups.com
The correct answer is that the default project layout has changed. See my previous email. Let me know if that works!

--
Joey "JoeLinux" Espinosa




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/R2FY3gjMxH0J.

maxim

unread,
Apr 4, 2012, 1:32:41 PM4/4/12
to django...@googlegroups.com
Ah, thank you. Your answer fixed the problem.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.

maxim

unread,
Apr 4, 2012, 2:49:45 PM4/4/12
to django...@googlegroups.com
Continuing on in the tutorial, I got to the part where it explains how to use the admin site. It seems that after enabling the admin, it cannot find the css files it uses, so the web page looks very strange.

When making a request for an admin page I get the following output from the runserver:
[04/Apr/2012 14:36:12] "GET /admin/ HTTP/1.1" 200 3740
[04/Apr/2012 14:36:13] "GET /admin/admin/css/base.css HTTP/1.1" 404 3861
[04/Apr/2012 14:36:13] "GET /admin/admin/css/dashboard.css HTTP/1.1" 404 3876

Which seems to indicate that it can't find base.css and dashboard.css.

I tried following the steps in the Customizing Admin Look and feel to get custom templates working to change the urls, but with no luck.
How do I get the default admin to find its css files?

Rahul Katragadda

unread,
Apr 5, 2012, 4:16:45 AM4/5/12
to django...@googlegroups.com
[04/Apr/2012 14:36:13] "GET /admin/admin/css/base.css HTTP/1.1" 404 3861
[04/Apr/2012 14:36:13] "GET /admin/admin/css/dashboard.css HTTP/1.1" 404 3876

Is this directory (in bold) correct?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/7-6nFmQGXpMJ.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages