Setting up a development environment on Windows

Install python ans setup tools

Grab the python installer from http://www.python.org/download/. Make sure you download a 2.x version. Version 3 is backwards incompatible and Django will not work under it.
Grab the setup tools installer from http://pypi.python.org/pypi/setuptools and run it.

Add python and easy_install to your path

Open the control panel, and select System, select the advanced tab and click on the Environment Variables button. You should see a variable named PATH (case is not important). If it's not there you can create it. Add the root folder of your python install (usually C:\python26) and the scripts folder (C:\python26\script). Use a semi colon ( ; ) to separate the values. Save and quit.

Install dependencies

Open a command prompt and use easy_install to install the required dependencies and some extra stuff that will help you out during development:

 
easy_install django
easy_install markdown
easy_install html5lib
easy_install south
easy_install python-openid
easy_install django-debug-toolbar
easy_install <dbadapter> #where dbaddapter is one of python-mysql or psycopg2 (mysql or postgres)

Optionally, you can forget the db adapter step if you plan to use SQLite, which I would recommend since it is very easy to create/delete/switch databases.

Install the database server

If you are planning to use either MySQL or PostgreSQL, you'll need to download and install the respective server. Grab the installers from:
MySQL - http://dev.mysql.com/downloads/mysql/
Postgres - http://www.postgresql.org/download/windows

Install them according to the respective documentation, and create an empty database.

Install Subversion (svn) and grab the latest OSQA sources

Grab the svn installer from http://subversion.apache.org/packages.html. Install it and checkout the OSQA sources onto your workspace:

 
svn co http://svn.osqa.net/svnroot/osqa/trunk/

Edit settings

Get into the OSQQA sources folder. Rename the file settings_local.py.dist to settings_local.py, and open it for edition. Find the database settings and edit them accordingly.

Create the database schema

Open a shell, get into the OSQA source and run:

manage.py syncdb --all
manage.py migrate forum --fake

When prompted to create a user, ignore it.

Run the development server

Now run:

manage.py runserver

Visit http://127.0.0.1:8000/ on your browser and you should see an happy working OSQA install.

Happy hacking

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. May 03, 2010

    Justin Grant says:

    The above instructions are missing a few important steps: 1. Don't forget to in...

    The above instructions are missing a few important steps:

    1. Don't forget to install Django!
    easy_install django

    2. Some of the easy_install steps won't actually install correctly on all windows version. On mine, installing markdown failed using easy_install. I was able to fix this by going to the sourceforge project site for markdown and downloading the setup EXE directly and installing it.

    3. There are no windows binaries on Sourceforge for python-mysql for Python 2.6, so the easy_install of python-mysql will fail on 2.6. I wasn't able to work aroudn this, so I opted to use sqlite3 instead initially, and will use postgres eventually.

    1. May 12, 2010

      daniel adashek says:

      hey justin, thanks for the tips, I am working on setting up an OSQA drop me a li...

      hey justin, thanks for the tips, I am working on setting up an OSQA drop me a line - I'd like to compare notes: wplwycpm@gmail.com

  2. May 05, 2010

    Hernâni Cerqueira says:

    This page http://www.codegood.com/archives/4 has some pre compiled auto installa...

    This page http://www.codegood.com/archives/4 has some pre compiled auto installable binaries for windows.

  3. Oct 01, 2010

    Justin Grant says:

    Another minor typo above: > (usually C:\python26) and the scripts folder (C:...

    Another minor typo above:

    > (usually C:\python26) and the scripts folder (C:\python26\script).

    The folder is "scripts" not "script". Plus, Python 2.7 is the latest release, so should probably change above to:

    > (usually C:\python27) and the scripts folder (C:\python27\scripts).

  4. Oct 07, 2010

    Justin Grant says:

    Also, under "create database schema" above, you must not accept Django's invitat...

    Also, under "create database schema" above, you must not accept Django's invitation to create a super-user. If you do, then the user ID of your OSQA user will not be 1, which will in turn prevent the stackexchange importer from working correctly.

  5. Jan 06, 2011

    Jashan Chittesh says:

    I just followed these steps and had two issues on the way: 1) "Grab the setup t...

    I just followed these steps and had two issues on the way:

    1) "Grab the setup tools installer from http://pypi.python.org/pypi/setuptools and run it." - this doesn't seem to work on Windows 2008 Server 64bit with the 64bit version of Python 2.7 installed. The installer fails with a message "Python version 2.7 required, which was not found in the registry." It seems as if this is a known issue (see http://bugs.python.org/issue6792) - I worked around it by installing the package locally and then manually copying the files (not my favorite solution but it worked).

    2) I first installed OSQA into some folder below Inetpub/wwwroot. With that setup, when trying to run "manage.py syncdb --all" I got a message that the module was not found. So I moved the folder below Python27/Lib/site-packages. That fixed this issue. Probably that's something obvious to people more intimate with Python/Django.

    Anyways, now it's working for me

  6. Jan 22, 2011

    Anaekwe Kossanah says:

    I install on my local machine Window 7 64bit WampServer. I thought I got everyth...

    I install on my local machine Window 7 64bit WampServer. I thought I got everything up and run until I key
    manage.py syncdb --all
    on the command line. Here is my persistent error.

    There is no South database module 'south.db.None' for your database. Please eith
    er choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or
     remove South from INSTALLED_APPS.
    

    I am a python newbie. I need some help

    1. Jan 22, 2011

      Anaekwe Kossanah says:

      Honestly, I am sure of the implication of my action. I just edited setting_local...

      Honestly, I am sure of the implication of my action.
      I just edited setting_local.py file and add "SOUTH"
      DISABLED_MODULES = ['books', 'recaptcha', 'project_badges','south']

      Afterwards I ran the cmd and I was able to progress.
      Someone, may advice me If am on the right path.
      I also feel It may be too early to ask, but can I possibly integrate this OSQA to a joomla site and have the single user authentication.

  7. Sep 29, 2012

    Irfan Haider says:

    While following the guide i face issues and then after lot of search i finally g...

    While following the guide i face issues and then after lot of search i finally got it working.

    Issue 1. The command "easy_install <dbadapter>" not working.

    Explanation:

    I tried to install it with "easy_install python-mysql" and its not working.

    Result:

    D:\My Projects\fourmsDEV\osqa>easy_install python-mysql
    Searching for python-mysql
    Reading http://pypi.python.org/simple/python-mysql/
    Couldn't find index page for 'python-mysql' (maybe misspelled?)
    Scanning index of all packages (this may take a while)
    Reading http://pypi.python.org/simple/
    No local packages or download links found for python-mysql
    Best match: None
    Traceback (most recent call last):
    File "D:\Python27\Scripts\easy_install-script.py", line 8, in <module>
    load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
    File "D:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1712, in main
    with_ei_usage(lambda:
    File "D:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1700, in with_ei_usage
    return f()
    File "D:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 1716, in <lambda>
    distclass=DistributionWithoutHelpCommands, **kw
    File "D:\Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
    File "D:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
    File "D:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
    File "D:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 211, in run
    self.easy_install(spec, not self.no_deps)
    File "D:\Python27\lib\site-packages\setuptools\command\easy_install.py", line 434, in easy_install
    self.local_index
    File "D:\Python27\lib\site-packages\setuptools\package_index.py", line 475, in fetch_distribution
    return dist.clone(location=self.download(dist.location, tmpdir))
    AttributeError: 'NoneType' object has no attribute 'clone'

    D:\My Projects\fourmsDEV\osqa>

    Solution:

    (Auto Install) Try "easy_install mysql-python" found but cannot install automatically

    D:\My Projects\fourmsDEV\osqa>easy_install mysql-python
    Searching for mysql-python
    Reading http://pypi.python.org/simple/mysql-python/
    Reading http://sourceforge.net/projects/mysql-python/
    Reading http://sourceforge.net/projects/mysql-python
    Best match: MySQL-python 1.2.4b2
    Downloading http://sourceforge.net/projects/mysql-python/files/mysql-python-test/1.2.4b2/MySQL-python-1.2.4b2.win32-py2.7.exe
    /download
    Processing download
    error: Couldn't find a setup script in c:\users\abrahe~1\appdata\local\temp\easy_install-y3jrcf\download

    D:\My Projects\fourmsDEV\osqa>manage.py syncdb --all

    Manual Install

    Goto http://sourceforge.net/projects/mysql-python/
    Download MySQL-python-1.2.4b2.win32-py2.7
    Install MySQL-python-1.2.4b2.win32-py2.7.exe (it should find your python dir)

  8. Sep 29, 2012

    Irfan Haider says:

    I got error when tried to run on Windows 7. Note that server is running without ...

    I got error when tried to run on Windows 7.
    Note that server is running without any issue.

    D:\osqa>manage.py runserver

    Validating models...

    0 errors found

    Django version 1.4.1, using settings 'osqa.settings'

    *Development server is running at http://127.0.0.1:8000/*

    Quit the server with CTRL-BREAK.

    Traceback (most recent call last):

      File "D:\Python27\lib\wsgiref\handlers.py", line 85, in run

        self.result = application(self.environ, self.start_response)

      File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\contrib\staticfiles\handlers.py", line 67, in _call_

        return self.application(environ, start_response)

      File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\core\handlers\wsgi.py", line 219, in _call_

        self.load_middleware()

      File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\core\handlers\base.py", line 51, in load_middleware

        raise exceptions.ImproperlyConfigured('Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname))

    ImproperlyConfigured: Middleware module "django.middleware.csrf" does not define a "CsrfResponseMiddleware" class

    [30/Sep/2012 02:16:52] "GET / HTTP/1.1" 500 59

    Traceback (most recent call last):

      File "D:\Python27\lib\wsgiref\handlers.py", line 85, in run

        self.result = application(self.environ, self.start_response)

      File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\contrib\staticfiles\handlers.py", line 67, in _call_

        return self.application(environ, start_response)

      File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\core\handlers\wsgi.py", line 219, in _call_

        self.load_middleware()

      File "D:\Python27\lib\site-packages\django-1.4.1-py2.7.egg\django\core\handlers\base.py", line 51, in load_middleware

        raise exceptions.ImproperlyConfigured('Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname))

    ImproperlyConfigured: Middleware module "django.middleware.csrf" does not define a "CsrfResponseMiddleware" class

    Solution:

    Use Django version 1.3.1 and now everything is working fine (OSQA is now running on my local machine)

    If you have installed latest version 1.4.x then you first you delete it and install version 1.3.1.

    1. From your python site-packages directory delete django-1.4.x-pyx.x.egg

     Example: D:\Python27\Lib\site-packages\django-1.4.2-py2.7.egg 
     

    2. Install Django version 1.3.1 with following command

     

    easy_install Django==1.3.1

     

  9. Sep 29, 2012

    Irfan Haider says:

    While installing on Windows 7 please change the following (its missing from guid...

    While installing on Windows 7 please change the following (its missing from guide)
    1. From your main OSQA directory (where you download the OSQA) change the "osqa.wsgi.dist" to "osqa.wsgi"
    2. Edit "osqa.wsgi" and enter your fourm location path. My file look like this.

    import os
    import sys
    sys.path.append('D:\My Projects\fourmsDEV')
    sys.path.append('D:\My Projects\fourmsDEV\osqa')

    # The first part of this module name should be identical to the directory name
    # of the OSQA source. For instance, if the full path to OSQA is
    # /home/osqa/osqa-server, then the DJANGO_SETTINGS_MODULE should have a value
    # of 'osqa-server.settings'.
    os.environ['DJANGO_SETTINGS_MODULE'] = 'osqa.settings'
    import django.core.handlers.wsgi
    application = django.core.handlers.wsgi.WSGIHandler()

    3. (Optional if source folder name is osqa) If your OSQA source folder name is other then osqa then you need to change the 'osqa.settings' too. Change it to the folder name that you have.
    Example:
    In above sample file we have two folder paths
    1. sys.path.append('D:\My Projects\fourmsDEV')
    2. sys.path.append('D:\My Projects\fourmsDEV\osqa')

    1.) is the folder which contain another folder named osqa
    2.) is the folder which contain forum files, that mean its the root folder of OSQA forum which contain "osqa.wsgi" and "manage.py" files.

    lets say you have 2nd folder like this
    d:\abc\xyz
    then osqa.settings will be xyz.settings because xyz is the folder which contain forum files.

    Hope this helps others.

  10. Nov 12, 2012

    Tomasz Foltman says:

    Hi, let me drop my 2p with this link, seems to be quite simple: Installing OSQ...

    Hi,

    let me drop my 2p with this link, seems to be quite simple:

    Installing OSQA on Windows in production

    http://www.helicontech.com/articles/installing-osqa-on-windows-in-production/