I tried it with django-mssql and while the installation and starting OSQA worked...
I tried it with django-mssql and while the installation and starting OSQA worked, there's trouble with posting questions (also reported, see links below). Also, trying to get OSQA working on IIS didn't work with the current PyISAPIe for me.
For "the rest" (which also gave me some trouble when I first tried), I got some notes which hopefully help someone. After trying Python 2.7 64bit and failing miserably, I took a somewhat more conservative approach:
OSQA Installation on Windows 2008 Server, IIS 7, MySQL, SQL Server 2008
NOTE: It may also work with 2.7 but it seemed to me that 2.6 is more "compatible" with some of the dependencies - e.g. PyISAPI is currently only available as a 2.6-build (might work with 2.7, too, though).
3. Make sure you have python and python/scripts in PATH (D:\Software\Python26;D:\Software\Python26\scripts in my case)
4. Install Dependencies (open console - make sure to open a new console, otherwise your PATH may not include the new Python-paths)
easy_install django
easy_install markdown
easy_install html5lib
easy_install south
easy_install python-openid
5.a. Only if you want to use MySQL (I have a MySQL database available, so I simply used this for testing the base installation):
Install MySQL-python 1.2.3 (unfortunately, easy_install python-mysql doesn't work … you might try this first, maybe it works by now; if it doesn't, go to http://www.codegood.com/archives/4 - note that in case you used Python 2.7, you can directly go to http://www.codegood.com/archives/129). Use MySQL-python-1.2.3c1.win32-py2.6.exe
Install django-mssql - first you need to install Pywin32. I tried using easy_install for that, but didn't work ("Unable to find vcvarsall.bat"), so instead, I installed from http://sourceforge.net/projects/pywin32/files/ - using Build 214 for Python 2.6, 32bit: pywin32-214.win32-py2.6.exe
Most likely you don't have to enter the default port (1433) when the DB runs on the default port - but if you have a non-default port, this is the way to add the port number (comma-separated).
6. Set the APP_URL in settings_local.py: You need to complete the APP_URL in your settings_local.py file - otherwise, the mail-messages with links will contain links that don't work. Something like:
APP_URL = 'http://www.mydomain.com:8000/' #used by email notif system and RSS
7. Create folder for OSQA below D:\Software\Python26\Lib\site-packages (or your Python/site-packages path), e.g. D:\Software\Python26\Lib\site-packages\osqa
8. Get current version of OSQA: Right-click on "osqa" (the new folder), select "SVN Checkout" from the context menu (requires that you properly installed TortoiseSVN), set URL to http://svn.osqa.net/svnroot/osqa/trunk/ - make sure Checkout Depth is "Fully recursive"
9. Configuration: Rename settings_local.py.dist to settings_local.py, change DATABASE-Settings according to how you had your MySQL database set up (you may have to create a user and database first).
10. Database Setup: In the console, go to the osqa-path, D:\Software\Python26\Lib\site-packages\osqa - and execute:
manage.py syncdb --all
manage.py migrate forum --fake
Do NOT create a user when prompted!
11. First test: Test if OSQA is working so far by running
manage.py runserver 1.2.3.4:8080 to start listening on a specific IP and port.
12. Create the first user (which will be the admin). login / Create account … choose appropriate screen name (admin or something like that).
13. Admin Settings Go to http://127.0.0.1:8000/admin/ to apply any necessary admin settings and switch on bootstrap mode if you wish so.
DONE
Getting OSQA running in IIS
14. I tried it with PyISAPIe ... but that was a major failure, even the test/proj from http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer didn't work (got a 500 error, did some research and tried a couple of things but in the end I guess the problem is that the instructions don't fully match with the current PyISAPIe version, see Examples/Django/Readme.txt) ... so then I tried
easy_install iaspi_wsgi
but that also didn't get me anywhere due to lack of documentation that I could conveniently work with.
I guess the best solution would probably be using WSGI with PyISAPIe but I wasn't able to find proper instructions on how to get that accomplished (and as I'm not a Python / Django developer, I guess I'm out of luck for now).
EDIT: I haven't tried those instructions, yet - but from the memory of my experiences, this might help with some (or even all) of the issues I ran into trying to use PyISAPIe:
I didn't even bother trying IIS. I'm trying to get it going on Apache for Window...
I didn't even bother trying IIS. I'm trying to get it going on Apache for Windows. I'm running into problems with the WSGI directives. I had to download wsgi module for windows and add it to the apache configuration file, but the wsgi directives still causing errors to be thrown.
My server is running but when tried to get access i got this.
Please help me.
...
My server is running but when tried to get access i got this.
Please help me.
D:\osqa>manage.py runserver Validating models... 0 errors found Django version 1.4.1, using settings 'osqa.settings' Development server is running athttp://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
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 maing 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')
first (1.) is the folder which contain another folder named osqa
second (2.) is the folder which contain fourm 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.
Comments (6)
Jan 22, 2011
Jashan Chittesh says:
I tried it with django-mssql and while the installation and starting OSQA worked...I tried it with django-mssql and while the installation and starting OSQA worked, there's trouble with posting questions (also reported, see links below). Also, trying to get OSQA working on IIS didn't work with the current PyISAPIe for me.
For "the rest" (which also gave me some trouble when I first tried), I got some notes which hopefully help someone. After trying Python 2.7 64bit and failing miserably, I took a somewhat more conservative approach:
OSQA Installation on Windows 2008 Server, IIS 7, MySQL, SQL Server 2008
1. Install Python 2.6 (32bit) from http://www.python.org/download/releases/2.6.6/ - using Windows x86 MSI Installer (I installed to D:\Software\Python26)
NOTE: It may also work with 2.7 but it seemed to me that 2.6 is more "compatible" with some of the dependencies - e.g. PyISAPI is currently only available as a 2.6-build (might work with 2.7, too, though).
2. Install setup tools installer for Python 2.6 from http://pypi.python.org/pypi/setuptools - using setuptools-0.6c11.win32-py2.6.exe
3. Make sure you have python and python/scripts in PATH (D:\Software\Python26;D:\Software\Python26\scripts in my case)
4. Install Dependencies (open console - make sure to open a new console, otherwise your PATH may not include the new Python-paths)
easy_install django
easy_install markdown
easy_install html5lib
easy_install south
easy_install python-openid
5.a. Only if you want to use MySQL (I have a MySQL database available, so I simply used this for testing the base installation):
Install MySQL-python 1.2.3 (unfortunately, easy_install python-mysql doesn't work … you might try this first, maybe it works by now; if it doesn't, go to http://www.codegood.com/archives/4 - note that in case you used Python 2.7, you can directly go to http://www.codegood.com/archives/129). Use MySQL-python-1.2.3c1.win32-py2.6.exe
NOTE: Assuming you have the database already installed … if not: http://dev.mysql.com/downloads/mysql/
5.b. Only if you want to use MS SQL Server:
... which you probably don't really want ATM as adding questions currently doesn't really work, see also:
http://meta.osqa.net/questions/4798/cannot-update-identity-column-id-when-adding-new-question http://meta.osqa.net/questions/5618/trouble-with-osqa-version-from-trunk-mssql-and-south
Anyways, the steps could be something like:
Install django-mssql - first you need to install Pywin32. I tried using easy_install for that, but didn't work ("Unable to find vcvarsall.bat"), so instead, I installed from http://sourceforge.net/projects/pywin32/files/ - using Build 214 for Python 2.6, 32bit: pywin32-214.win32-py2.6.exe
Then, you need to be able to get the package … get "TortoiseHg 1.1.8 with Mercurial 1.7.3 - x64 Windows" from http://mercurial.selenic.com/downloads/ (if you are on 64bit). Then create a folder somewhere, right-click and do "Clone…" entering the path https://django-mssql.googlecode.com/hg/django-mssql to the source path.
Follow the installation instructions (copy sqlserver_ado to lib/site-packages).
Watch out - you need to have the IP-address as host (names won't work) and the port right behind the IP-address. Example database settings
// MS SQL Server Settings
DATABASE_NAME = 'OSQA'
DATABASE_USER = 'secretDBUser'
DATABASE_PASSWORD = 'secretPassword'
DATABASE_ENGINE = 'sqlserver_ado'
DATABASE_HOST = '127.0.0.1,1433'
DATABASE_PORT = ''
Most likely you don't have to enter the default port (1433) when the DB runs on the default port - but if you have a non-default port, this is the way to add the port number (comma-separated).
6. Set the APP_URL in settings_local.py: You need to complete the APP_URL in your settings_local.py file - otherwise, the mail-messages with links will contain links that don't work. Something like:
APP_URL = 'http://www.mydomain.com:8000/' #used by email notif system and RSS
6. Install TortoiseSVN from http://tortoisesvn.net/downloads.html
7. Create folder for OSQA below D:\Software\Python26\Lib\site-packages (or your Python/site-packages path), e.g. D:\Software\Python26\Lib\site-packages\osqa
8. Get current version of OSQA: Right-click on "osqa" (the new folder), select "SVN Checkout" from the context menu (requires that you properly installed TortoiseSVN), set URL to http://svn.osqa.net/svnroot/osqa/trunk/ - make sure Checkout Depth is "Fully recursive"
9. Configuration: Rename settings_local.py.dist to settings_local.py, change DATABASE-Settings according to how you had your MySQL database set up (you may have to create a user and database first).
10. Database Setup: In the console, go to the osqa-path, D:\Software\Python26\Lib\site-packages\osqa - and execute:
manage.py syncdb --all
manage.py migrate forum --fake
Do NOT create a user when prompted!
11. First test: Test if OSQA is working so far by running
manage.py runserver
and connecting to the given URL (http://127.0.0.1:8000/). You could also call
manage.py runserver 1.2.3.4:8080 to start listening on a specific IP and port.
12. Create the first user (which will be the admin). login / Create account … choose appropriate screen name (admin or something like that).
13. Admin Settings Go to http://127.0.0.1:8000/admin/ to apply any necessary admin settings and switch on bootstrap mode if you wish so.
DONE
Getting OSQA running in IIS
14. I tried it with PyISAPIe ... but that was a major failure, even the test/proj from http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer didn't work (got a 500 error, did some research and tried a couple of things but in the end I guess the problem is that the instructions don't fully match with the current PyISAPIe version, see Examples/Django/Readme.txt) ... so then I tried
easy_install iaspi_wsgi
but that also didn't get me anywhere due to lack of documentation that I could conveniently work with.
I guess the best solution would probably be using WSGI with PyISAPIe but I wasn't able to find proper instructions on how to get that accomplished (and as I'm not a Python / Django developer, I guess I'm out of luck for now).
EDIT: I haven't tried those instructions, yet - but from the memory of my experiences, this might help with some (or even all) of the issues I ran into trying to use PyISAPIe:
http://whelkaholism.blogspot.com/2010/10/django-on-iis.html
Jan 07, 2011
Roly Vicaria says:
I didn't even bother trying IIS. I'm trying to get it going on Apache for Window...I didn't even bother trying IIS. I'm trying to get it going on Apache for Windows. I'm running into problems with the WSGI directives. I had to download wsgi module for windows and add it to the apache configuration file, but the wsgi directives still causing errors to be thrown.
Jul 03, 2011
Alex says:
Django can be quickly installed on IIS7 with Helicon Zoo http://www.helicontech....Django can be quickly installed on IIS7 with Helicon Zoo http://www.helicontech.com/articles/run-django-apps-on-iis
But I had no luck starting OSQA on IIS7 although it starts fine in the Python development server.
Aug 10, 2011
kalam havij says:
Jashan Chittesh great job here. thanks. I had a bit of problem only getting the ...Jashan Chittesh great job here. thanks. I had a bit of problem only getting the database (MySql) part right! I really enjoyed your contribution.
Sep 29, 2012
Irfan Haider says:
My server is running but when tried to get access i got this. Please help me. ...My server is running but when tried to get access i got this.
Please help me.
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.egg2. Install Django version 1.3.1 with following command
easy_install Django==1.3.1Sep 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 maing 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.
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')
first (1.) is the folder which contain another folder named osqa
second (2.) is the folder which contain fourm 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.