1. New to the forums? Check out our Mentorship Program!
    Our mentors will answer your questions and help you become a part of the community!
  2. Welcome to Smogon Forums! Please take a minute to read the rules.

Programming [WIP] Setting up the Smogon development environment

Discussion in 'Technical Projects' started by ryubahamut, Jan 30, 2009.

  1. monkfish

    monkfish what are birds?
    is a Forum Moderator Alumnus

    Joined:
    May 31, 2006
    Messages:
    5,004
    i think this will need updating after chaos is done changing things up?
  2. Desch

    Desch

    Joined:
    Nov 14, 2009
    Messages:
    33
    I'm curious, why do you guys use Python instead of PHP? (I'm a PHP dev)
  3. DougJustDoug

    DougJustDoug Knows the great enthusiasms
    is a member of the Site Staffis an Artistis a Programmeris a CAP Contributoris an Administratoris a Battle Server Admin Alumnusis a Smogon IRC SOp Alumnusis a Tiering Contributor Alumnus
    CAP Leader

    Joined:
    Jun 26, 2007
    Messages:
    3,060
    I have been setting up a new dev laptop, and I had to go back through the pain of getting my Smogon environment working again (I'm on Vista). Ryu's tut still works pretty well, but I have a few additional notes for anyone attempting this these days, since some stuff has changed.

    I doubt many people are actually going to use this info. So, I'm posting this more as a reminder to myself, rather than a full-blown how-to guide. Anyway, here's a few things that are different than the steps in the OP:

    1) Smogon site code is kept in a Mercurial repository. There are several Windows-compatible clients for HG (thats the cute acronym for all things related to Mercurial. hg, the symbol for mercury, get it?), but the base command line tool works just fine.

    The Smogon HG repository is at this URL:

    http://monsan.to/hg/smogon


    2) I had issues getting MySQLdb for Python to install properly for some reason. I'm not sure why, but ultimately this blog post gave me step-by-step instructions to get it compiled and installed:

    http://www.fuyun.org/2009/12/install-mysql-for-python-on-windows/

    Super helpful, and it worked perfectly for me.


    3) You need Werkzeug nowadays. If you have setuptools installed like the OP says, then installing Werkzeug is a breeze. Just do this at the command prompt:

    easy_install Werkzeug


    4) Blow off all the lightorm stuff in the OP. The Smogon site isn't using it any more, afaik.


    5) In the OP, it refers to making a config.py file in the smogon directory. You still need to do that, but you need more than just the password. Put a user and address in there too. For example, my config.py looks something like this:
    Code:
    user="jimbo"
    password="isFat"
    address="localhost"
    Change the values for user and password to suit your MySQL installation, or just to be nicer to Jimbo.


    If you do all that stuff, then test.py should work just fine, and you will be up and running with a local install of the Smogon environment. You won't have any database data, however. I may see what I can do about that sometime in the future. But, in the meantime, the running code is a decent start.

    FWIW, I use PyScripter for all Python stuff on Windows. Although I'm willing to deal with Eclipse-hell for most Java stuff, it was a constant nightmare for me to get PyDev to work right. I'm not real strong with Python anyway, and the Eclipse plugin seemed to just confuse me even more. PyScripter has all the features you expect from an IDE, but isn't the massive bloatware explosion that most IDE's impose on your machine. Give it a try.
  4. Seven Deadly Sins

    Seven Deadly Sins ~hallelujah~
    is a Site Staff Alumnusis a Forum Moderator Alumnusis a Tiering Contributor Alumnusis a Smogon Media Contributor Alumnusis a Contributor Alumnusis a Battle Server Moderator Alumnus

    Joined:
    May 29, 2008
    Messages:
    4,269
    Thanks a bunch Doug, I'm gonna take a shot at getting the new framework set up. Any info in regards to getting actual database data to mess with would be awesome, though.
  5. monkfish

    monkfish what are birds?
    is a Forum Moderator Alumnus

    Joined:
    May 31, 2006
    Messages:
    5,004
    I'm trying to set up a dev env, have followed all the steps mentioned in this thread. However, on running test.py:
    Code:
     * Running on http://www.smogon.com:4000/
    Traceback (most recent call last):
      File "C:\Programming\smogon\test.py", line 37, in <module>
        run_simple('www.smogon.com', 4000, app, use_debugger=True, use_reloader=True
    )
      File "C:\Python27\lib\site-packages\werkzeug-0.6.2-py2.7.egg\werkzeug\serving.
    py", line 529, in run_simple
        test_socket.bind((hostname, port))
      File "C:\Python27\lib\socket.py", line 224, in meth
        return getattr(self._sock,name)(*args)
    socket.error: [Errno 10049] The requested address is not valid in its context
    The solution is to change line 37 of test.py to subsitute in 'localhost' for 'www.smogon.com' (!)

    should be mentioned somewhere that port 4000 is the default for test.py

    also it would be nice to get a db dump (or a limited access user account to the live db)

    current problem is that i have no content - every page is a 404?
  6. Dragonitro

    Dragonitro

    Joined:
    Feb 20, 2010
    Messages:
    12

    The repository are dead => Error 404

Users Viewing Thread (Users: 0, Guests: 0)