https://github.com/cariad/py-wordpress-database
A Python package that sets up a WordPress database.
https://github.com/cariad/py-wordpress-database
aws-secrets-manager mysql python wordpress
Last synced: about 2 months ago
JSON representation
A Python package that sets up a WordPress database.
- Host: GitHub
- URL: https://github.com/cariad/py-wordpress-database
- Owner: cariad
- License: mit
- Created: 2018-12-01T11:21:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-11T20:18:03.000Z (over 7 years ago)
- Last Synced: 2025-02-02T08:43:27.080Z (over 1 year ago)
- Topics: aws-secrets-manager, mysql, python, wordpress
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-wordpress-database
[](https://circleci.com/gh/cariad/py-wordpress-database/tree/master)
A Python package that sets up a WordPress database.
`wpdatabase` will:
- Create the database, if it doesn't exist already.
- Create the WordPress user, if it doesn't exist already.
`wpdatabase` is idempotent; if the database and the user already exist then it will return successfully.
Note that `wpdatabase` currently only supports MySQL databases.
## Installation
```shell
pip install wpdatabase
```
## Prerequisites
`wpdatabase` 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](https://github.com/cariad/py-wpconfigr).
## Command-line usage
If you need to specify to the database's administrator username and password:
```shell
python -m wpdatabase --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:
```shell
python -m wpdatabase --wp-config /www/wp-config.php \
--admin-credentials-aws-secret-id AdminSecretID \
--admin-credentials-aws-region eu-west-1
```
## Development
To install development dependencies:
```shell
pip install -e .[dev]
```
To run the tests:
```shell
python test.py
```