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
Metadata
Release files for wpdatabase2 0.0.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wpdatabase2-0.0.15.tar.gz | 9.5 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wpdatabase2-0.0.15-py3.8.egg | Legacy Egg format | - | - | Details |
| wpdatabase2-0.0.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.7 kB
Release files / wpdatabase2-0.0.15.tar.gz
| Download URL | wpdatabase2-0.0.15.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94dd5d5384809435e845b4aca3ee2427e572978dfffc1bb6181c7babe6f0d1a9
|
|
BLAKE2b-256 checksum How to use checksums |
ff70be10df231759c9dd66d79e89add8df05642e8f433020e100f5d8fd8dc34e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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.5
|
Release files / wpdatabase2-0.0.15-py3.8.egg
| Download URL | wpdatabase2-0.0.15-py3.8.egg |
|---|---|
| Size | 24.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
351cc3f1aa58571a66b181579892da38fffd9afd8cc8db72857155edb1fc9b2f
|
|
BLAKE2b-256 checksum How to use checksums |
5242628238f5f1954a8837928eab3d11de1e656e490aee464812149fdc2a480d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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.5
|
Release files / wpdatabase2-0.0.15-py3-none-any.whl
| Download URL | wpdatabase2-0.0.15-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
772d02d60f93f845b1ff4743dc1736e3a8bbab8c5d1f344ce0f912b881684803
|
|
BLAKE2b-256 checksum How to use checksums |
b1311e457311e6c93416ff60715a48265ec9c6f86354dd8764e3de605f36116f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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.5
|