pysec
pysec copied to clipboard
PySEC with Django & Sqlite3
I'm having issues implementing this with Django and Sqlite3. Your Read Me stipulates change the DATA_DIR in the settings.py module but there is no DATA_DIR to change unless copy and pasted into settings. Is this what we're supposed to do? I also didn't understand the "Put this Django app under manage.py". What exactly do you mean?
Ultimately I'm trying to get the sec_import_index and sec_xbrl_to_csv to work. Maybe a step by step to getting those to work with Django & Sqlite3 will help others. Thanks in advance for any help.
Try this. Go to the base pysec folder and ~~make an empty database, and~~ rename local-settings-example.py to local-settings.py:
$ cd ~/path/to/pysec && python -c "import sqlite3; sqlite3.connect('edgar.db')"
$ mv ./local-settings-example.py ./local-settings.py
$ mkdir ./pysec/data
Then change these settings in local-settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'edgar.db'
### Django automatically creates a db
### Rest not needed
}
}
SECRET_KEY = 'eddiebravo'
DATA_DIR = "%s/pysec/data" % PROJECT_ROOT
Then rerun:
$ python manage.py syncdb
$ python manage.py sec_import_index
This should populate the database with entries from a zipped SEC index file. Open up an interactive session and test out the commands in example.py with:
$ python manage.py shell
from pysec.models import *
filing = Index.objects.filter(form='10-K',cik=1057758).order_by('-date')[0]
x = filing.xbrl()
x.fields
this doesn't seem to be helping.. i am still getting the error Unknown command: 'syncdb' Type 'manage.py help' for usage.
You've probably figured this out, but for anyone else who finds this: syncdb
was deprecated in django. Now the command is python manage.py migrate
could someone help me understand how to use this package?