WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to fill in values for WP install page (5 posts)

  1. tbbt
    Member
    Posted 5 months ago #

    Hello all,

    I am trying to dynamically install WP in a VM when I bring it up. The goal being the WP instance that comes up in the VM should be configurable, have content according to what I want etc..

    I can bring up the VM, and download latest.tar.gz , and modify 000-sites for apache and wp-config programatically.

    I am stuck at the main WP-install page which has the 5 min install. I need to fill in:
    - site title
    - password twice
    - email
    etc..
    and click the install button

    Once I do this I can programatically fill in posts and pages etc.. using python-wordpress-xmlrpc

    What I need to do is skip the manual installation step above. Is there some file on the wordpress directory I can modify that will allow me to basically install WP without going through the http://IPaddr/wp-admin/install.php ?

    My wp-config.php already has the username, DB name, password etc.. in it. If i try to use python-wordpress-xmlrpc to fill in posts/pages without completing the install step, understandably, things do not work out. So in essence can I use a language like Python etc.. to effectively do what the install page is doing (I could try to use selenium to fill out the install page - but that might be a bit of a heavyweight approach)

    Any advice will be great!

  2. tbbt
    Member
    Posted 5 months ago #

    Found this interesting topic on Stackoverflow - but no easy solution proposed: http://stackoverflow.com/questions/5732384/automate-wordpress-install-from-python

  3. Rod Whiteley
    Member
    Posted 5 months ago #

    As an alternative to calling wp_install(), I suppose you could dump an existing installed database, modify it as required, and use it to create the database for your new installation.

  4. tbbt
    Member
    Posted 5 months ago #

    Here's what I did - quite simple actually - and I apologize in advance for the hackish looking code:

    import argparse
    import mechanize

    def wpFillInstallPage(sname):
    br=mechanize.Browser()
    br.open('http://127.0.0.1/wp-admin/install.php')
    br.select_form(nr=0)
    br['weblog_title']='Welcome to ' + sname
    br['user_name']='wpuser'
    br['admin_password']='password'
    br['admin_password2']='password'
    br['admin_email']='abcd@abcd.com'
    br.submit()

    if __name__ == "__main__":

    parser = argparse.ArgumentParser(description='Fill out the wp install page')
    parser.add_argument('siteName', type=str, help='the name of the site')

    args = parser.parse_args()

    wpFillInstallPage(args.siteName)

    Now I can use python to set up posts etc..

  5. tbbt
    Member
    Posted 5 months ago #

    Well - I'm back, apparently things are not as rosy as I thought (surprise!) :-)

    When I try to login to WP - I am getting a download request for wp-login.php - instead of logging me into the admin panel. If I fill in the install page manually - then putting in the username and passwd does log me into the admin panel properly.

    Can anyone advise why this is happening and a possible solution ?

    More details below

    Once I use the code above (in the last reply) - navigating to the URL (like 127.0.0.1) gives the following page content:

    WordPress
    Already Installed

    You appear to have already installed WordPress. To reinstall please clear your old database tables first.

    Log In

    at http://localhost/wp-admin/install.php

    However, if I manually fill in the values on the actual install page I get the following:

    Success!

    WordPress has been installed. Were you expecting more steps? Sorry to disappoint.
    Username wpuser
    Password

    Your chosen password.

    at http://localhost/wp-admin/install.php?step=2

    then I can successfully visit - http://localhost/wp-login.php and log in as usual.

Reply

You must log in to post.

About this Topic