Re: django.db.utils.DatabaseError: (1046, 'No database selected')
Thanks mate. This was a great reply.
-Praveen
On Sunday, December 23, 2012 8:00:51 AM UTC-8, Ramiro Morales wrote:
-- On Sunday, December 23, 2012 8:00:51 AM UTC-8, Ramiro Morales wrote:
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
> <prave...@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 view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/w-6clyjn_mgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home