On Sun, Dec 23, 2012 at 12:59 PM, Ramiro Morales <cra...@gmail.com> wrote: > 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.
Forgot to say that this is clearly derscribed in the relevant tutorial section: https://docs.djangoproject.com/en/1.4/intro/tutorial01/#database-setup -- 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.