samedi 30 janvier 2016

sqlite configuring with django

I have been assigned the task of setting up an online database with sqlite via django- where it will contain columns of information. My problem is that I can't figure out which is establishing table where the information will go- my models.py script or should I do it with a "CREATE TABLE" command? An example of the code in my models.py script is below:

    class Person(models.Model):
       firstname=models.CharField(max_length=100)
       lastname=models.CharField(max_length=100)

The tutorial that I was given recommended this command:

    insert into freezer_person (firstname,lastname)

However upon executing this command I naturally got an error saying "table does not exist" i.e. I have to use the "CREATE TABLE" command. so when I tried:

           "CREATE TABLE in freezer_person(...)" 

It returned that "in" was syntactically incorrect. So my question is how do I go about creating a table that will intake info from models.py?- I can't seem to find any info on this...

Aucun commentaire:

Enregistrer un commentaire