Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PySEC with Django & Sqlite3 #11

Open
balexbyrd opened this issue Jan 27, 2014 · 4 comments
Open

PySEC with Django & Sqlite3 #11

balexbyrd opened this issue Jan 27, 2014 · 4 comments

Comments

@balexbyrd
Copy link

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.

@peitalin
Copy link

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

@kumarivin
Copy link

this doesn't seem to be helping.. i am still getting the error
Unknown command: 'syncdb'
Type 'manage.py help' for usage.

@dashstander
Copy link

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

@joeymizrahi
Copy link

could someone help me understand how to use this package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants