From e350ebc7763d89e5e5b0cfab217299af6223f80b Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sat, 25 Jun 2022 15:54:54 +0300 Subject: [PATCH] Troglaptop: install MariaDB --- handbook/troggle/serverconfig.html | 2 +- handbook/troggle/troglaptop.html | 44 +++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/handbook/troggle/serverconfig.html b/handbook/troggle/serverconfig.html index e73f0e047..aea9689a3 100644 --- a/handbook/troggle/serverconfig.html +++ b/handbook/troggle/serverconfig.html @@ -65,7 +65,7 @@ See the live report on which urls resolve to which actual folders at xapian (search function) - xapian.org. Wookey did this in 2020.
  • kanboard (task planning) - kanboard.org. Wookey did this in 2022.
  • boe (bank of expo - not troggle) diff --git a/handbook/troggle/troglaptop.html b/handbook/troggle/troglaptop.html index 2b9be78f0..7d550040c 100644 --- a/handbook/troggle/troglaptop.html +++ b/handbook/troggle/troglaptop.html @@ -409,8 +409,50 @@ Nearly half the code deals with importing and parsing data, so you need to test

    The public server uses a MariaDB SQL database and development is usually done using a single-user sqlite database which is a standard Django option.

    -You will find it very, very useful to see what is going on if you look directly at the data in the database (just a single file in the sqlite case) and browse the data in the tables. This is vital when doing Django migrations between Django versions. A light-weight, simple db browser is DB Browser for SQLite. Connecting directly the the MariaDB database with a control panel or workbench gives even more tools and documentation capabilities. See the troggle server documentation for how to install MariaDB. +You will find it very, very useful to see what is going on if you look directly at the data in the database (just a single file in the sqlite case) +and browse the data in the tables. This is vital when doing Django migrations between Django versions. A light-weight, simple db browser is DB Browser for SQLite. Connecting directly the the MariaDB database with a control panel or workbench gives even more tools and documentation capabilities. See the +troggle server documentation for how to install MariaDB. +

    When Ubuntu is running on WSL, it does not use systemctl. So you need specific instructions for installing MariaDB under WSL, +see +

    +

    Create a new dedicated administrative MariaDB user 'expo' who can access all databases. Log in to the MariaDB command with +

    sudo mysql
    +
    +and execute these commands: +
    +GRANT ALL PRIVILEGES on *.* TO 'expo'@'%' IDENTIFIED BY 'my-secret-password-schwatzmooskogel' WITH GRANT OPTION;
    +SET PASSWORD FOR expo=PASSWORD('my-secret-password-schwatzmooskogel');
    +FLUSH PRIVILEGES;
    +QUIT;
    +
    +and you will need to set this user and password in your localsettings.py: +
    +DATABASE = {
    +    'default': { 
    +        'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
    +        'NAME' : 'troggle',                   # Or path to database file if using sqlite3.
    +        'USER' : 'expo',                      
    +        'PASSWORD' : 'my-secret-password-schwatzmooskogel',       
    +        'HOST' : '',                          # Set to empty string for localhost. Not used with sqlite3.
    +        'PORT' : '',                          # Set to empty string for default. Not used with sqlite3.
    +    }
    +}
    +
    +

    But it still does not work

    +

    That is because we need to install the python tools that talk to mariadb. +

    +pip install mariadb
    +
    +but note that there is a problem with using python 3.10 in that some bits of pip are not correct and you will get a +ImportError: cannot import name 'html5lib' error. +[Currently under investigation, June 2022]
    Go on to: Troggle architecture