Re: Entering initial data into django database

2016-03-20 Thread Lawrence Muriuki
Ok..thanks..it worked...Created a script to create the fixture file and update it with every record...what a community this is! On Sunday, March 20, 2016 at 12:50:30 PM UTC-7, ludovic coues wrote: > > First, you should create a fixture file with some sample data. Two > entry, just like in the

Re: Entering initial data into django database

2016-03-20 Thread ludovic coues
First, you should create a fixture file with some sample data. Two entry, just like in the documentation is good. This way, you know you have a working fixture file. Then, you write a python function which take a list of bet and output a fixture file just like the exemple you have done. Finally,

Re: Entering initial data into django database

2016-03-20 Thread Lawrence Muriuki
Thanks ludovic, here is my code for the scraper.. from .models import Betting import re import requests import urllib from bs4 import BeautifulSoup urls= "https://sms.betyetu.co.ke/tomorrow.html; htmlfile = urllib.urlopen(urls) htmltext = htmlfile.read() soup = BeautifulSoup(htmltext,

Re: Entering initial data into django database

2016-03-20 Thread ludovic coues
There is a page in the documentation dealing with initial data [1]. The good news is that you don't have to write more code. You insert your data in a file and load it with the manage.py command. Out of the box, JSON, XML and SQL are supported. [1]

Entering initial data into django database

2016-03-20 Thread Lawrence Muriuki
Hi All, I have built a web scraper to scrape a website and get all match fixtures for a particular day. Wanted to know how to insert that initial data into django database and where that code should live..I have currently put the code in init.py but it looks and sounds wrong according to a