Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Hard Red Spring Wheat Dissemination, 2011
branch: master

This branch is 913 commits behind matti-kariluoma-ndsu:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
wheat_website
zipcode
README
data_schema.ods
zipcode.tar.bz2

README

Prereqs:
 Python:
  Download and Install Python, version 2.4 or greater.
 Django:
  Download Django (http://www.djangoproject.com/download/)
  Install Django (http://docs.djangoproject.com/en/dev/intro/install/)
  Verify Django is installed correctly:
   $ python -c  "import django; print django.get_version()"
   # should print the version number and exit w/o errors

Database/Models development:
 Should you change one of the models, you must delete the old table
 for that model before your change will take effect.
  $ python manage.py dbshell
  > .schema
  # shows the database schema, look for your old table
  # i.e. if the model you changed was called "Location" in the directory
  # "wheat_data", then the table is probably called 
  # "wheat_data_location".
  > drop table wheat_data_location
  # Hit Ctrl+D to exit.
  
Command to put zipcode.csv into a compatible format for importing to the db:
  $ rm tmp.csv; i=1; while [ $i -lt 43205 ]; do sed -n -e 's/^/\"'"$i"'\",/' -e ''"$i"' p' zipcode.csv >> tmp.csv ;let i=i+1; done; sed 's/\"//g' tmp.csv > tmp2.csv; sed -n '/.*,.../ p' tmp2.csv > import.csv; rm tmp.csv tmp2.csv

To dump a table from the testing (sqlite) db:
  $ sqlite> .mode csv
  $ sqlite> .output your_filename.csv
  $ sqlite> select * from your_table;
  $ sqlite> .exit
 
To populate a table in the testing (sqlite) db:
  $ sqlite> .separator ","
  $ sqlite> .import import.csv your_table
  $ sqlite> .exit
Something went wrong with that request. Please try again.