A Python package that checks and/or sets up a WordPress database.
Project description
py-wordpress-database
A big call out to @cariad for the original version of this library
A Python package that sets up a WordPress database.
wpdatabase2
will:
- Provide a way to check to see if the wordpress database already exists
- Return the version details of the wordpress database (if it exists)
- Create the database, if it doesn't exist already.
- Create the WordPress user, if it doesn't exist already.
wpdatabase2
is idempotent; if the database and the user already exist then it will return successfully.
Note that wpdatabase2
currently only supports MySQL databases.
Installation
pip install wpdatabase2
Prerequisites
wpdatabase2
assumes that the following properties have already been set in the wp-config.php
file:
Property | Description |
---|---|
DB_HOST |
Host or endpoint of the MySQL database server. |
DB_USER |
WordPress database user. |
DB_PASSWORD |
WordPress database password. |
If you need help adding these values to wp-config.php
then check out wpconfigr.
Command-line usage
If you need to specify to the database's administrator username and password:
python -m wpdatabase2
--wp-config /www/wp-config.php \
--admin-username garnet \
--admin-password love
If you're deploying WordPress into Amazon Web Services (AWS) and have your administrator username and password held in Secrets Manager:
python -m wpdatabase2
--wp-config /www/wp-config.php \
--admin-credentials-aws-secret-id AdminSecretID \
--admin-credentials-aws-region eu-west-1
Library usage
import wpdatabase2
wpdb = WpDatabase('path to wp-config.php')
print(wpdb.get_database_version())
Development
To install development dependencies:
pip install -e .[dev]
To run the tests:
python test.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file wpdatabase2-0.0.9.tar.gz
.
File metadata
- Download URL: wpdatabase2-0.0.9.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72340321e630e2965a11f07bcf1b8489f8787034dc643027e1a67b1bf2ec0241 |
|
MD5 | 95c0ae6b85a0f3fc70e9785c16f1da70 |
|
BLAKE2b-256 | b1240ddfa55c999226439d7492709c19c6e2f487f2717daafd0054c97ecd0e2b |
File details
Details for the file wpdatabase2-0.0.9-py3.8.egg
.
File metadata
- Download URL: wpdatabase2-0.0.9-py3.8.egg
- Upload date:
- Size: 23.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1367e4c0d1d654fdee1c1a36dc7606eb82d63b3dd349bf5a615cfede8a358a20 |
|
MD5 | bf88035b8fa64c9c6b77dc383448fa34 |
|
BLAKE2b-256 | 6116b293f626020d1e13cf261d83ae1aa4a4055fbd868ed93f2580294ac79ead |
File details
Details for the file wpdatabase2-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: wpdatabase2-0.0.9-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4c372310a3aed55671fea598a91892922f58a786ac6b3fb857280d15c842d86 |
|
MD5 | 85fce29ca1f004afa1e89fe0e5ff9400 |
|
BLAKE2b-256 | 11451592f8e120fe3de0f8aa2fba11c785c937a00d8649c0bb40409ec4a31351 |