Recently I downloaded a US zip code data file in comma separated (CSV) format. Below are the steps and python script that I used to import that data into a django model for my site Wantbox.com.
The Steps to Import CSV Data into Django:
- Create your django model (mine is called “ZipCode”, see below).
- Create a python script called “load_data.py” with your correct django project and directory info (see mine below).
- Put the CSV file and “load_data.py” script in the same directory.
- From that directory run: