Step 16: Set up new Database
For the database, once again, I am going to assume that your setup is the same as mine. If it isn't, hopefully it is close enough to give you a hint of what you need to do.
Okay, instead of doing all of this with ssh, lets just go to cpanel (this is, assuming you have cpanel) and going to the section 'Databases', which seems to be a standard. Click on 'MySQL® Databases' It is so easy. Just go to where it says 'Create a new database'. While you do so, note down the database name (which is usually the site username with an underscore and then the name you give, such as 'vernon_zingdb' or whatever), username, password and so on.
When you are done, log out of cpanel and go into your guts directory and open the 'settings.py' file that is there.
Under the 'DATABASE = {' enter the following:
DATABASES = {
'default': {
'ENGINE': 'mysql',
'NAME': 'vernon_zingdb', # The name you ended up with for the database.
'USER': 'the_username_you_created_under_databases_in_cpanel',
'PASSWORD': 'your_password_for_the_database',
'HOST': '', # leave this one black
'PORT': '3306',
}
}
You should also set the 'DEBUG' to 'False', but, maybe just wait a little bit, lets just get it working up on the server.
Also change these three lines here:
MEDIA_ROOT = 'http://domain_name.com/media'
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/admin-media/'
ftp the settings.py file from guts to your 'zing' directory.
We are nearing the end now. Ssh into your site again, and (remember what we typed in the .bashrc file) type 'zing' and you should be whizzed into your 'zing' directory.
Type 'python manage.py validate'. If you get errors, you can check your settings.py file or get help from the hostgator help center. Or tweet me, maybe I missed something obvious.
Of course, if it works, run 'python manage.py syncdb'. Of course, you'll have to create a new superuser, like you did before on your home site. You may want to use the same password as you did on your own site.
Exit ssh, go to your 'http://your_domain.com/admin/ page, log in and see if it is all good. Write a few blog posts and see if they show up as you expected on the site. You'll probably want to add to the CSS, and make it all look better.
If it all went well, you should have a working blog. Now write something cracking in there and send me a link to check it out.