Django syncdb with local_settings - Graphite

3.4k Views Asked by At

I am trying to install graphite on a linux node in a automated fashion. Script that install the graphite, configure and start the services.

Python 2.7 Django 1.5.12

One of the step to install graphite need **

manage.py syncdb

**

Earlier I was trying to do in interactive way where I was able to create super user .

python /opt/graphite/webapp/graphite/manage.py syncdb

Once installed it has following tables.

account_mygraph             auth_user_user_permissions
account_profile             dashboard_dashboard       
account_variable            dashboard_dashboard_owners
account_view                django_admin_log          
account_window              django_content_type       
auth_group                  django_session            
auth_group_permissions      events_event              
auth_permission             tagging_tag               
auth_user                   tagging_taggeditem        
auth_user_groups            url_shortener_link

I would like to make it automated by providing my own settings in local_setting.py file.

I have following in my file.

DATABASES = {
    'default': {
        'NAME': '/opt/graphite/storage/graphite.db',
        'ENGINE': 'django.db.backends.sqlite3',
        'USER': 'root',
        'PASSWORD': 'Pa55word',
        'HOST': 'localhost',
        'PORT': ''
    }
}

When I run following

python /opt/graphite/webapp/graphite/manage.py syncdb --settings=local_settings

It execute with following output

Creating tables ...
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

It do not create tables and auth users etc.

sqlite> .tables list
sqlite> 

How do I have all tables by providing my local_settings through local_setting.py file.

Please advise.

1

There are 1 best solutions below

2
nagsrk On

First you need to migrate to resemble the new db.

python /opt/graphite/webapp/graphite/manage.py migrate --settings=local_settings

and then syncdb. Also django might ask for makemigrations