Forums

Django Mezzanine MySQL database: table...doesn't exist

Hello all, I have setup mezzanine CMS for my site: http://dahc.pythonanywhere.com but I want to use MySQl instead of default sqlite3, so I setup the config file "local_settings.py" and type: "ENGINE": "django.db.backends.mysql", "NAME": "DAHC$prometeo" (my database name), "USER": "DAHC", "PASSWORD": "(mysql password)", "HOST": "mysql.server", "PORT": "(empty)". and then reload the web app. But it gives me error: ProgrammingError at /: (1146, "Table 'DAHC$prometeo.django_site' doesn't exist"). Am I doing something wrong?

Nevermind I figured out I had to to this after configuring a new databse: python manage.py syncdb

yay!

DAHC, I'm in a similar situation. I edited out my settings.py file with all of my info for the mysql database after running python manage.py syncdb and reloaded my app. It seemed to work for me. Did you change anything in your local_settings.py file or is that not necessary?

I think DAHC was transitioning from sqlite to mysql when he encountered that error, and the way he solved it was by running syncdb.

Conrad, Yeah I was transitioning from sqlite to mysql and got a similar error. I ran syncdb and it went away. How can I know if I did that successfully? Sorry but I'm still new to everything here.

well- can you access the stuff in your mysql database?

try putting stuff into it using your django app. etc

When you say you edited out all the stuff about mysql database in the post above... I'm assuming you meant you changed all the references to sqlite to mysql appropriately, and set the user/passwd etc accordingly right?

Yeah but I when I change all my settings to use my MySQL database it always throws an error and never works?

Never mind I got it up and running now. I had to install python-mysql since my app is using python 2.7

             / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄\    
<<<<<<:>~  <   Yay!          |   
             \_________/

can someone please tell me.. where we have to give python manage.py syncdb

In a bash console in the directory where your manage.py file is.

Ok. Thank you. Please can you also tell me how to get all tables from local my SQL DB to pythonanywhere...because when try to list tables in pythonanywhere it is showing emptyset

You can use the process here http://help.pythonanywhere.com/pages/MySQLBackupRestore/ to backup your local database ans then restore it to PythonAnywhere.