Programming [WIP] Setting up the Smogon development environment


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 Live Chat Contributor Alumnusis a Tiering Contributor Alumnus
CAP Leader
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:

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:

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 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 looks something like this:
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 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.
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.


what are birds?
is a Forum Moderator Alumnus
I'm trying to set up a dev env, have followed all the steps mentioned in this thread. However, on running
 * Running on
Traceback (most recent call last):
  File "C:\Programming\smogon\", line 37, in <module>
    run_simple('', 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\", 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 to subsitute in 'localhost' for '' (!)

should be mentioned somewhere that port 4000 is the default for

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?