Automate WordPress installation with python

I have a python program that installs a wordpress site on my server. It downloads the zip and unpacks it into a directory, configures the database and user, configures the configuration file. Now I would like to call the wp_install function in wp-admin / include / upgrade.php and pass it the parameters in which it needs $ weblog_title, $ user_name, $ admin_email ...

My question is, how can I call this function from python? Can I make urllib.urlopen, and if so, how can I call the wp_install function with the correct parameters?

+3
python wordpress
source share
2 answers

It seems that wp_install() is called inside /wp-admin/install.php during step 1 and after the form data has been verified. If you submit ?step=1& ... (all other required form fields), this will result in a call to wp_install . So yes, you should be able to use urllib (2) for this.

+1
source share

Urllib is an option, but since your script runs on the local computer anyway, I would probably use os.system. Thus, you can execute the PHP script as from a shell. You should look into the php file on how to pass parameters.

0
source share

All Articles