Hey All,

I was walking through the tutorial part 1 on polls. When i executed "*python 
manage.py sql polls*" i got this stack trace
*
*
*Traceback (most recent call last):*
*  File "manage.py", line 10, in <module>*
*    execute_from_command_line(sys.argv)*
*  File 
"/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
line 443, in execute_from_command_line*
*    utility.execute()*
*  File 
"/Library/Python/2.7/site-packages/django/core/management/__init__.py", 
line 382, in execute*
*    self.fetch_command(subcommand).run_from_argv(self.argv)*
*  File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
line 196, in run_from_argv*
*    self.execute(*args, **options.__dict__)*
*  File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
line 232, in execute*
*    output = self.handle(*args, **options)*
*  File "/Library/Python/2.7/site-packages/django/core/management/base.py", 
line 304, in handle*
*    app_output = self.handle_app(app, **options)*
*  File 
"/Library/Python/2.7/site-packages/django/core/management/commands/sql.py", 
line 19, in handle_app*
*    return u'\n'.join(sql_create(app, self.style, 
connections[options.get('database')])).encode('utf-8')*
*  File "/Library/Python/2.7/site-packages/django/core/management/sql.py", 
line 26, in sql_create*
*    tables = connection.introspection.table_names()*
*  File "/Library/Python/2.7/site-packages/django/db/backends/__init__.py", 
line 910, in table_names*
*    return self.get_table_list(cursor)*
*  File 
"/Library/Python/2.7/site-packages/django/db/backends/mysql/introspection.py", 
line 33, in get_table_list*
*    cursor.execute("SHOW TABLES")*
*  File "/Library/Python/2.7/site-packages/django/db/backends/util.py", 
line 40, in execute*
*    return self.cursor.execute(sql, params)*
*  File 
"/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 
114, in execute*
*    return self.cursor.execute(query, args)*
*  File 
"/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/MySQLdb/cursors.py",
 
line 202, in execute*
*    self.errorhandler(self, exc, value)*
*  File 
"/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.8-intel.egg/MySQLdb/connections.py",
 
line 36, in defaulterrorhandler*
*    raise errorclass, errorvalue*
*django.db.utils.DatabaseError: (1046, 'No database selected')*

I've been googling and everyone says that i don't have access to the mysql 
database for "polls" but i was able to access the database when i entered 
*mysql 
-u root -h localhost polls*

This is how my settings.py looks like for database:

*DATABASES = {*
*    'default': {*
*        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 
'mysql', 'sqlite3' or 'oracle'.*
*        'NAME': '',                      # Or path to database file if 
using sqlite3.*
*        'USER': 'root',                      # Not used with sqlite3.*
*        'PASSWORD': '',                  # Not used with sqlite3.*
*        'HOST': 'localhost',                      # Set to empty string 
for localhost. Not used with sqlite3.*
*        'PORT': '',                      # Set to empty string for 
default. Not used with sqlite3.*
*    }*
*}*

Also, here is to show that i actually selected the database

*mysql> use test*
*Database changed*
*mysql> GRANT ALL ON test.* TO 'testuser'@'localhost';*
*Query OK, 0 rows affected (0.08 sec)*
*
*
*mysql> quit*
*Bye*

my mac has been finicky with databases on RoR and so i am trying to switch 
to django. Does anyone know where the problem is?

-Praveen

-- 
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/-/Z_jpiK5Q894J.
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.

Reply via email to