On Sun, Dec 23, 2012 at 6:45 AM, Praveenkumar Venkatesan
<praveev...@gmail.com> wrote:
> 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):
>  [...]
> 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.

It sems you have correctly created a MySQL database, you've given it
the name 'test' and you've verified it exist adn can be used. Good.

You've also provided Django presumably the right server name (localhost)
and credentials (root/empty) so it can access such database. Great.

But there is a crucial link missing. You haven't told Django you want it to use
that database fotr this project/application.

That's what the NAME setting above is for. Use it.

The eror message isn't as clear as one would wish, I think it's generated by
the MySQL low level driver. But it points in the right direction about which
is the issue.

Good luck,

-- 
Ramiro Morales

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

Reply via email to