Initialize Project

This console script is responsible for asking questions about the database connection, to create the db.ini file and to create the tables in the database.

Questions are:

  • What database technology do you want to use?

    • sqlite: this will create a file in the current folder and use it as DB

    • mysql: this will connect to a local or remote mysql server, additional information is then required:

      • hostname: of the mysql server, defaults to 127.0.0.1

      • database: must already exist on hostname

      • username: as registered in the privileged users of the mysql server

      • password: his password

      • prefix: useful when users have only access to a single database. Similar to the way wordpress handles prefixes. The tables will be named %prefix%_config (etc) instead of config, for example.

The SQLite choice will create a xxx.sqlite file in the current (project) folder, while, for MySQL, one has to create an empty database first on the mysql server, see how to do this .

To run this script:

msnoise db init --help

Usage:  [OPTIONS]

  This command initializes the current folder to be a MSNoise Project by
  creating a database and a db.ini file.

Options:
  --tech TEXT  Database technology: 1=SQLite 2=MySQL
  --help       Show this message and exit.

Warning

The credentials will be saved in a flat text file in the current directory. It’s not very safe, but until now we haven’t thought of another solution.