Skip to content
Branch: master
Go to file
Code

README

Prerequisites:
 Python:
  Download and Install Python, version 2.7.3 or greater. (http://www.python.org/download)
 Scipy:
  Download and install scipy, version 0.7 or greater. (http://www.scipy.org/download)
 Django:
  Ensure a previous version of Django is not installed; run 
   $ python -c  "import django; print django.get_version()"
  If so, remove it before continuing.
  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
   # Sep 2012: Verified the project is compatible with Django 1.4
   # Jun 2013: Verified the project is compatible with Django 1.5.1
 R:
  Install R, $sudo apt-get install r-base
 django-nopassword:
  $ pip install django-nopassword

Configure:
 Create the file 'variety_trials_website/secrets.py' and define
 SECRET_KEY and EMAIL_HOST_PASSWORD
  SECRET_KEY:
   string, about 50 characters in length. use random ascii characters
  EMAIL_HOST_PASSWORD:
   string, password for django-nopassword to use (only needed if enabling admin interface)

Install to a fresh machine w/apache (Ubuntu/Debian syntax):
NOTE: Ensure a previous version of Django is not installed; run 
 $ python -c  "import django; print django.get_version()"
If so, remove it before continuing.

 $ sudo apt-get install git sqlite3 python-{sqlite,scipy,django,pip} libapache2-mod-wsgi r-base
 $ pip install django-nopassword
 $ git clone http://github.com/matti-kariluoma-ndsu/wheat-dissem.git
 $ cd wheat-dissem
 $ cat README # this file you are currently reading
 $ nano variety_trials_website/secrets.py # define SECRET_KEY and EMAIL_HOST_PASSWORD
 $ cat apache/httpd.conf >> /etc/apache2/httpd.conf # then fix any conflicts
 $ sudo /etc/init.d/apache2 reload # or restart

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
  # "variety_trials_data", then the table is probably called 
  # "variety_trials_data_location".
  > drop table variety_trials_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> .separator ";"
  $ sqlite> .mode list
  $ sqlite> .output your_filename.list
  $ sqlite> select * from your_table;
  $ sqlite> .exit
 
To populate a table in the testing (sqlite) db:
  $ sqlite> .separator ";"
  $ sqlite> .import import.list your_table
  $ sqlite> .exit

To add the lines from these files into psql:
	$ psql> \copy variety_trials_data_location from 'your_filename' with delimiter ';' null as ''

NOTE: Did a chmod a+w {variety_trials_website/, variety_trials_website/sqlite.db} , will need to be undone when we move on from sqlite.

About

Hard Red Spring Wheat Dissemination, 2011

Resources

License

Releases

No releases published
You can’t perform that action at this time.