Previous  Top

More options

With only 3 lines of code we already have a useable tool to manage our database of books with a user login feature. To keep it simple, the program gives default values to many options

OptionDefault
which database will be used ? kirbybase
where do the databases stand in the filesystem ? in the same directory as the configuration script
how is the users database called ? the same as the main database + '_users'
what are the fields in the users database ? ['login:str','password:str']

If you want to change these options, you add new variables in the configuration file :

Change the configuration file like this (you must change the data_directory to a valid path in your filesystem) :

name = "books"
fields = ["title:str","year:int","author:str"]
security = 'standard'
users_name = 'students'
users_fields = ['login:str','password:str','email:str','klass:str']

Notice that the field for the student's class is written klass instead of class, because class is a Python keyword

If you go back to the web site, you will notice that when you want to add a new user the form will have changed with the new fields you have specified :

That's all for the moment. You can now take a look at the complete documentation to know more about Karrigell