From 7134a8a516bdee8100572327c49771eec30bd256 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Fri, 18 Jun 2010 19:48:49 -0400 Subject: made some progress on documentation --- askbot/doc/HOW_TO_DEBUG | 39 --- askbot/doc/INSTALL.pip | 31 --- askbot/doc/INSTALL.webfaction | 345 -------------------------- askbot/doc/UPGRADE | 24 -- askbot/doc/askbot-requirements.txt | 9 - askbot/doc/old/INSTALL.pip | 31 +++ askbot/doc/old/README | 2 + askbot/doc/old/askbot-requirements.txt | 9 + askbot/doc/scratch | 12 - askbot/doc/source/conf.py | 3 + askbot/doc/source/debugging.rst | 43 ++++ askbot/doc/source/index.rst | 117 +++++---- askbot/skins/default/templates/questions.html | 3 +- askbot/urls.py | 7 +- 14 files changed, 165 insertions(+), 510 deletions(-) delete mode 100644 askbot/doc/HOW_TO_DEBUG delete mode 100644 askbot/doc/INSTALL.pip delete mode 100644 askbot/doc/INSTALL.webfaction delete mode 100644 askbot/doc/UPGRADE delete mode 100644 askbot/doc/askbot-requirements.txt create mode 100644 askbot/doc/old/INSTALL.pip create mode 100644 askbot/doc/old/README create mode 100644 askbot/doc/old/askbot-requirements.txt delete mode 100644 askbot/doc/scratch create mode 100644 askbot/doc/source/debugging.rst diff --git a/askbot/doc/HOW_TO_DEBUG b/askbot/doc/HOW_TO_DEBUG deleted file mode 100644 index fbbdb1f7..00000000 --- a/askbot/doc/HOW_TO_DEBUG +++ /dev/null @@ -1,39 +0,0 @@ -1) LOGGING -Please remember that log files may contain plaintext passwords, etc. - -Please do not add print statements - at least do not commit them to git -because in some environments printing to stdout causes errors - -Instead use python logging this way: --------------------------------- -#somewere on top of file -import logging - -#anywhere below -logging.debug('this maybe works') -logging.error('have big error!') -#or even -logging.debug('') #this will add time, line number, function and file record -#sometimes useful record for call tracing on its own -#etc - take a look at http://docs.python.org/library/logging.html -------------------------------- - -in Askbot logging is currently set up in settings_local.py.dist -please update it if you need - in older revs logging strings have less info - -messages of interest can be grepped out of the log file by module/file/function name -e.g. to take out all django_authopenid logs run: ->grep 'askbot\/django_authopenid' log/django.askbot.log | sed 's/^.*MSG: //' -in the example above 'sed' call truncates out a long prefix -and makes output look more meaningful - -2) DJANGO DEBUG TOOLBAR -askbot works with django debug toolbar -if debugging under apache server, check -that debug toolbar media is loaded correctly -if toolbar is enabled but you do not see it, possibly some Alias statement -in apache config is wrong in your VirtualHost or elsewhere - -3) If you discover new debugging techniques, please add here. -Possible areas to improve - at this point there is no SQL query logging, -as well as request data and http header. diff --git a/askbot/doc/INSTALL.pip b/askbot/doc/INSTALL.pip deleted file mode 100644 index 2f817ff8..00000000 --- a/askbot/doc/INSTALL.pip +++ /dev/null @@ -1,31 +0,0 @@ -* Install virtualenv and pip: - easy_install virtualenv - easy_install pip - -* Install MySQL: - sudo apt-get install mysql-client mysql-server - -* Install sphinxsearch. See: - [optional] - http://sphinxsearch.com/downloads.html - http://www.hackido.com/2009/01/install-sphinx-search-on-ubuntu.html - git://github.com/johnl/deb-sphinx-search.git - -* Install a virtual environment OUTSIDE of this directory: - pip install -E ~/env -r askbot-requirements.txt -[there is discussion on the pinax forums about what it should be outside -the source directory] - -* Notice that you will need to register with recaptcha.net and receive - recaptcha public and private keys that need to be saved in your - settings_local.py file - -* Start your environment: - source ~/env/bin/activate - -* Install mysql-python into your virtualenv, because we can't -automagically install it with pip: - easy_install --prefix ~/env/ mysql-python - -For more information about why pip can't automatically install the -MySQL driver, see this message: http://groups.google.com/group/python-virtualenv/msg/ea988085951c92b3 diff --git a/askbot/doc/INSTALL.webfaction b/askbot/doc/INSTALL.webfaction deleted file mode 100644 index a449ffe6..00000000 --- a/askbot/doc/INSTALL.webfaction +++ /dev/null @@ -1,345 +0,0 @@ -NOTE: this file may be a bit out of date - -Detailed instructions for installing Askbot on WebFaction - -Adapted from http://code.pinaxproject.com/wiki/DetailedPinaxWebfaction/ - -Please email turian at gmail with any updates or corrections. - - -Installing Askbot on Webfaction ------------------------------------- - -Details the steps for setting up Askbot on a Webfaction shared-hosting -account, including email setup, using Apache2, mod_wsgi, psycopg2. - -If you want to search-and-replace through this file, you will need to replace: - askbot_server [name of Webfaction application, which will be in ~/webapps/] - askbot_static [name of Webfaction application for static media serving] - DOMAIN.com [domain name for Askbot site] - PORT [port number assigned by WebFaction to your mod_wsgi application] - SITENAME [name you give the Askbot site, which will contain the apache logs] - myaskbot [name of the Askbot project] - MAILBOX_USERNAME [username you give the email address] - MAILBOX_PASSWORD [password that webfaction gives to this email username] - AskbotDATABASE_NAME [username you give the database] - AskbotDATABASE_PASSWORD [password that webfaction gives to this database] - ~/envs/askbot [directory for the Askbot python environment, grep for 'env'] - USERNAME [your WebFaction username] - -Some things I'm not sure about: - -Here's what I don't know how to do: - * Set up a nginx server for static media. - * Configure sphinx search - * Use PostgreSQL, not MySQL: http://askbot.net/question/13/can-i-use-askbot-with-postgresql - - -Webfaction Control Panel --------------------------- - -(Note: if you sign up and pick django it will create the application -for you, website/subdomain and associate the two for you.) - - If necessary, add or create any domains or subdomains you may need. - - https://panel.webfaction.com/domain/list/ - - Let's call the domain DOMAIN.com. - - Create a new Webfaction application with a "Type:" of "mod_wsgi - 2.5/Python2.5", naming it "askbot_server". (These instructions - might also work with mod_wsgi 2.0, if you like.) - - https://panel.webfaction.com/app_/list - - Note the port number assigned to the mod_wsgi application. Call - it PORT. - - Create a new Webfaction website which will associate the subdomain - with the new askbot_server application. Give it name SITENAME, at least one - domain, and set it to use the askbot_server application for the site's - root location, "/". - - https://panel.webfaction.com/site/list - - You will need to create a database, typically one for each project - you create. Change the type to PostgreSql and modify the name (it - defaults to your webfaction account name) by adding an underscore - and a project-specific identifier such as "_askbot". Before - leaving this section of the control panel, you may wish to change - the password. - - https://panel.webfaction.com/database/create - - Call these AskbotDATABASE_NAME and AskbotDATABASE_PASSWORD. - - Save the database password for later. - - [The following I haven't figured out yet] - You will probably want to add a static media server. This is a - Webfaction application. I created one of type "Static only (no - .htaccess)" and with the name of "askbot_static". - - https://panel.webfaction.com/app_/create - - To configure email, you need an email mailbox. Add one here. Note - that your mailbox password shouldn't be the same password you use - to SSH to webfaction. - - https://panel.webfaction.com/mailbox/list - - Save the mail password for later. - We will call the username and password MAILBOX_USERNAME and - MAILBOX_PASSWORD, respectively. - You might also consider adding an email address like admin@DOMAIN.com, - here: - - https://panel.webfaction.com/email/list - - -Askbot Software --------------- - - Log onto webfaction and get the code. I use my fork because I have - a simple pip installation: - git://github.com/turian/askbot.git - In my situation, I keep source code in ~/utils/src, create - virtual environments in ~/envs/askbot, and create Pinax projects in - ~/webapps/askbot_server/projects. - - You will need pip + virtualenv installed: - - easy_install --prefix=~/utils/ pip - easy_install --prefix=~/utils/ virtualenv - - cd ~/utils/src/ - git clone git://github.com/turian/askbot.git - cd askbot - - # We need python2.5 to be compatible with WSGI - python2.5 ~/utils/bin/pip install -E ~/envs/askbot -r askbot-requirements.txt - source ~/envs/askbot/bin/activate - - # [Optional] If you want a MySQL database - easy_install-2.5 --prefix ~/envs/askbot/ mysql-python - -Additional Software -------------------- - - [Note that PostgreSQL installation doesn't work for me.] - - You will need to install psycopg2 separately for PostgreSQL. - Psycopg2 requires a little fiddling. Continuing to - work in the ~/utils/src/ directory: - - cd ~/utils/src/ - wget http://initd.org/pub/software/psycopg/psycopg2-2.0.13.tar.gz - tar zxf psycopg2-2.0.13.tar.gz - cd psycopg2-2.0.13 - nano setup.cfg - - # edit the line reading "#pg_config=" so that it reads: - "pg_config=/usr/local/pgsql/bin/pg_config" - - python2.5 setup.py build - python2.5 setup.py install - - -Create a Project ----------------- - - In Pinax, you clone a project from Askbot. - However, Askbot we just copy it. - - cd ~/webapps/askbot_server - mkdir projects - cd projects - cp -R ~/utils/src/askbot myaskbot - cd myaskbot - export AskbotPROJECT=`pwd` - - Make some directories, as described in the Askbot INSTALL file: - [okay I haven't actually done this yet] - -# mkdir -p $AskbotSITE/upfiles/ -# mkdir -p $AskbotLOG -# sudo chown -R `whoami`:www-data $AskbotSITE -# sudo chown -R `whoami`:www-data $AskbotLOG -# chmod -R g+w $AskbotSITE/upfiles -# chmod -R g+w $AskbotLOG - - - Edit the settings files: - - cd $AskbotPROJECT - cp settings_local.py.dist settings_local.py - vi settings_local.py settings.py - - Pay attention to the following settings: - - DATABASE_ENGINE = 'mysql' - DATABASE_NAME = 'AskbotDATABASE_NAME' - DATABASE_USER = 'AskbotDATABASE_NAME' - DATABASE_PASSWORD = 'AskbotDATABASE_PASSWORD' - - EMAIL_HOST='smtp.webfaction.com' - EMAIL_HOST_USER='MAILBOX_USERNAME' - EMAIL_HOST_PASSWORD='MAILBOX_PASSWORD' - EMAIL_PORT='25' - DEFAULT_FROM_EMAIL = 'MAILBOX_USERNAME@DOMAIN.com' - SERVER_EMAIL = 'MAILBOX_USERNAME@DOMAIN.com' - # The following setting might not be necessary, it's used in Pinax tho - CONTACT_EMAIL = "MAILBOX_USERNAME@DOMAIN.com" - - APP_URL = 'http://DOMAIN.com' #used by email notif system and RSS - - [Later on, the install instructions should talk about] - SERVE_MEDIA = False # [Not present, not ready yet] - - Create a directory for logs: - - cd $AskbotPROJECT - mkdir log - - Modify mail cron scripts "cron/send_email_alerts" as follows: - [Pinax has cron/emit_notices.sh, cron/retry_deferred.sh, - cron/send_mail.sh, are these also necessary?] - - #!/bin/sh - - WORKON_HOME=~/envs/askbot - PROJECT_ROOT=~/webapps/askbot_server/projects/myaskbot/ - - # activate virtual environment - . $WORKON_HOME/bin/activate - - cd $PROJECT_ROOT - python manage.py send_email_alerts >> $PROJECT_ROOT/log/cron_mail.log 2>&1 - - Use command "crontab -e" to add this script to your cron file, to run twice a day:: - - 1 0,12 * * * ~/webapps/askbot_server/projects/myaskbot/cron/send_email_alerts - - [Configure sphinx] - - Create the database tables, indices, and so forth: - - python manage.py syncdb - - [Ignore the following static media steps, I haven't tried them] - Build media directory links within the project and create symbolic - links on the static media server. - python manage.py build_media -all - mkdir ~/webapps/Askbot_STATIC/myaskbot - ln -sd ~/webapps/askbot_server/projects/myaskbot/site_media ~/webapps/Askbot_STATIC/myaskbot/site_media - - - Set up the badges: - - 1. You should run the SQL commands in: - - sql_scripts/badges.sql - - 2. Edit paths in the file `cron/multi_award_badges`. (This - file doesn't yet exist in the git repositories, so just - copy `cron/send_email_alerts` and make sure the command - `multi_award_badges` is executed.) - - 3. Run `cron/multi_award_badges` to make sure it works okay. - - 4. Use `crontab -e` to call `cron/multi_award_badges` maybe - four times an hour. - - 4,19,34,49 * * * * ~/webapps/askbot_server/projects/myaskbot/cron/multi_award_badges - - 5. Repeat steps 1-4 for `cron/once_award_badges`. - - -Configure Apache2 ----------------- - - Edit ~/webapps/askbot_server/apache2/conf/httpd.conf as follows:: - - ServerAdmin "MAILBOX_USERNAME@DOMAIN.com" - ServerRoot "/home/USERNAME/webapps/askbot_server/apache2" - ServerName DOMAIN.com - - LoadModule dir_module modules/mod_dir.so - LoadModule env_module modules/mod_env.so - #LoadModule setenvif_module modules/mod_setenvif.so - LoadModule log_config_module modules/mod_log_config.so - LoadModule mime_module modules/mod_mime.so - LoadModule rewrite_module modules/mod_rewrite.so - LoadModule wsgi_module modules/mod_wsgi.so - - KeepAlive Off - Listen PORT - LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - CustomLog /home/USERNAME/logs/user/access_askbot_server_log combined - ErrorLog /home/USERNAME/logs/user/error_askbot_server_log - ServerLimit 2 - - #SetEnvIf X-Forwarded-SSL on HTTPS=1 - - WSGIPythonPath /home/USERNAME/envs/askbot/lib/python2.5/site-packages/ - WSGIScriptAlias / /home/USERNAME/webapps/askbot_server/projects/myaskbot/django.wsgi - - LoadModule alias_module modules/mod_alias.so - WSGIDaemonProcess askbotWSGI user=USERNAME group=USERNAME threads=25 python-path=/home/USERNAME/envs/askbot/lib/python2.5/site-packages - WSGIProcessGroup askbotWSGI - - NameVirtualHost 127.0.0.1:PORT - - #ErrorLog "logs/myaskbot_2009_05_06.log" - SetHandler none - #Alias /site_media /home/USERNAME/webapps/static/myaskbot/site_media - - #force all content to be served as static files - #otherwise django will be crunching images through itself wasting time - Alias /content/ /home/USERNAME/webapps/askbot_server/projects/myaskbot/templates/content/ - Alias /forum/admin/media/ /home/turian/envs/askbot/lib/python2.5/site-packages/django/contrib/admin/media/ - #AliasMatch /([^/]*\.css) /home/USERNAME/webapps/askbot_server/projects/myaskbot/templates/content/style/$1 - - # Order deny,allow - # Allow from all - - - If you want virtual hosts of the admin interface under HTTPS, please - look at Askbot's install file. - - Edit ~/webapps/askbot_server/projects/myaskbot/deploy/django.wsgi as follows:: - - import os - import sys - - # redirect sys.stdout to sys.stderr for bad libraries like geopy that uses - # print statements for optional import exceptions. - sys.stdout = sys.stderr - - from os.path import abspath, dirname, join - from site import addsitedir - - # add the virtual environment site-packages to the path - from site import addsitedir - addsitedir('/home/USERNAME/envs/askbot/lib/python2.5/site-packages') - - sys.path.insert(0, abspath(join(dirname(__file__), "../"))) - sys.path.append(abspath(dirname(__file__))) - - from django.conf import settings - os.environ["DJANGO_SETTINGS_MODULE"] = "myaskbot.settings" - - #print sys.path - - from django.core.handlers.wsgi import WSGIHandler - application = WSGIHandler() - -And then you're up and running with: - - ~/webapps/askbot_server/apache2/bin/stop - ~/webapps/askbot_server/apache2/bin/start - -You should log in to the admin interface (http://DOMAIN.com/admin/), -and go to "Sites > Sites", and change the domain name that is used in -all emails. diff --git a/askbot/doc/UPGRADE b/askbot/doc/UPGRADE deleted file mode 100644 index 538b75a0..00000000 --- a/askbot/doc/UPGRADE +++ /dev/null @@ -1,24 +0,0 @@ -if you are upgrading this software, then - -* first download the newer version and write it over the old one. - -for the database migrations you will need to use django package called "south" - -Install it (if you don't have it yet) with: - - easy_install South - -* 'south' must already be in the list of INSTALLED_APPS - otherwise you must have downloaded wrong version of Askbot - -if you are using south the very first time, then type: - - python manage.py migrate forum 0001_initial --fake - -otherwise skip above step. - -Finally run - - python manage.py migrate forum --auto - -then all relevant schema and data migrations will be applied diff --git a/askbot/doc/askbot-requirements.txt b/askbot/doc/askbot-requirements.txt deleted file mode 100644 index 66a37fbe..00000000 --- a/askbot/doc/askbot-requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -django>=1.1 # Note: email subscription sender job requires Django 1.1, everything else works with 1.0 -#mysql-python # Can't use with pip, see http://groups.google.com/group/python-virtualenv/msg/ea988085951c92b3 -python-openid -html5lib -markdown2 -git+git://github.com/robhudson/django-debug-toolbar.git -git+git://github.com/dcramer/django-sphinx.git -svn+http://recaptcha-django.googlecode.com/svn/trunk/ -svn+http://recaptcha.googlecode.com/svn/trunk/recaptcha-plugins/python/ diff --git a/askbot/doc/old/INSTALL.pip b/askbot/doc/old/INSTALL.pip new file mode 100644 index 00000000..2f817ff8 --- /dev/null +++ b/askbot/doc/old/INSTALL.pip @@ -0,0 +1,31 @@ +* Install virtualenv and pip: + easy_install virtualenv + easy_install pip + +* Install MySQL: + sudo apt-get install mysql-client mysql-server + +* Install sphinxsearch. See: + [optional] + http://sphinxsearch.com/downloads.html + http://www.hackido.com/2009/01/install-sphinx-search-on-ubuntu.html + git://github.com/johnl/deb-sphinx-search.git + +* Install a virtual environment OUTSIDE of this directory: + pip install -E ~/env -r askbot-requirements.txt +[there is discussion on the pinax forums about what it should be outside +the source directory] + +* Notice that you will need to register with recaptcha.net and receive + recaptcha public and private keys that need to be saved in your + settings_local.py file + +* Start your environment: + source ~/env/bin/activate + +* Install mysql-python into your virtualenv, because we can't +automagically install it with pip: + easy_install --prefix ~/env/ mysql-python + +For more information about why pip can't automatically install the +MySQL driver, see this message: http://groups.google.com/group/python-virtualenv/msg/ea988085951c92b3 diff --git a/askbot/doc/old/README b/askbot/doc/old/README new file mode 100644 index 00000000..d93d5e7d --- /dev/null +++ b/askbot/doc/old/README @@ -0,0 +1,2 @@ +This directory contains old bits of documentation +for possible future use or deletion. Not practically useful. diff --git a/askbot/doc/old/askbot-requirements.txt b/askbot/doc/old/askbot-requirements.txt new file mode 100644 index 00000000..66a37fbe --- /dev/null +++ b/askbot/doc/old/askbot-requirements.txt @@ -0,0 +1,9 @@ +django>=1.1 # Note: email subscription sender job requires Django 1.1, everything else works with 1.0 +#mysql-python # Can't use with pip, see http://groups.google.com/group/python-virtualenv/msg/ea988085951c92b3 +python-openid +html5lib +markdown2 +git+git://github.com/robhudson/django-debug-toolbar.git +git+git://github.com/dcramer/django-sphinx.git +svn+http://recaptcha-django.googlecode.com/svn/trunk/ +svn+http://recaptcha.googlecode.com/svn/trunk/recaptcha-plugins/python/ diff --git a/askbot/doc/scratch b/askbot/doc/scratch deleted file mode 100644 index 948055fa..00000000 --- a/askbot/doc/scratch +++ /dev/null @@ -1,12 +0,0 @@ -Error upon restarting Apache: - -Name duplicates previous WSGI daemon definition - -different keys - empty space counts for translation keys -{% blocktrans %}page number {{num}} {% endblocktrans %} -{% blocktrans %}page number {{num}}{% endblocktrans %} - -for admin interface downloaded two packages: -django-keyedcache -django-livesettings -from http://bitbucket.org/bkroeze/ diff --git a/askbot/doc/source/conf.py b/askbot/doc/source/conf.py index 8e9b110c..c6382c51 100644 --- a/askbot/doc/source/conf.py +++ b/askbot/doc/source/conf.py @@ -92,6 +92,9 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' +html_theme_options = { + 'rightsidebar':'true', +} # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/askbot/doc/source/debugging.rst b/askbot/doc/source/debugging.rst new file mode 100644 index 00000000..017d41d9 --- /dev/null +++ b/askbot/doc/source/debugging.rst @@ -0,0 +1,43 @@ +This document describes techniques that can be used to debug Askbot and other Django projects +If you discover new debugging techniques, please add here. + +=================== +USE LOGGING IN CODE +=================== + +Please remember that log files may contain plaintext passwords, etc. + +Please do not add print statements - at least do not commit them to git +because in some environments printing to stdout causes errors + +Instead use python logging this way:: + #somewere on top of file + import logging + + #anywhere below + logging.debug('this maybe works') + logging.error('have big error!') + #or even + logging.debug('') #this will add time, line number, function and file record + #sometimes useful record for call tracing on its own + #etc - take a look at http://docs.python.org/library/logging.html + +in Askbot logging is currently set up in settings.py +please update it if you need - in older revs logging strings have less info + +messages of interest can be grepped out of the log file by module/file/function name +e.g. to take out all django_authopenid logs run:: + >grep 'askbot\/django_authopenid' log/django.askbot.log | sed 's/^.*MSG: //' + +in the example above `sed` call truncates out a long prefix +and makes output look more meaningful + +===================== +DJANGO DEBUG TOOLBAR +===================== + +askbot works with django debug toolbar +if debugging under apache server, check +that debug toolbar media is loaded correctly +if toolbar is enabled but you do not see it, possibly some Alias statement +in apache config is wrong in your VirtualHost or elsewhere diff --git a/askbot/doc/source/index.rst b/askbot/doc/source/index.rst index 48eacfe8..35b147fc 100644 --- a/askbot/doc/source/index.rst +++ b/askbot/doc/source/index.rst @@ -26,6 +26,7 @@ interpreter for the installation and testing as the one assigned (or will be assigned) to the webserver. If you already have `easy_install`_ on your system, then type:: + easy_install askbot If you are using the easy\_install tool, make sure that it was also @@ -33,6 +34,7 @@ originally installed with the python interpreter mentioned above, otherwise use the second method: Download the latest version of askbot_, unzip and untar the archive and run:: + python setup.py install If you are planning to use askbot on Windows, please install @@ -65,10 +67,12 @@ If any of the provided links do not work please try to look up those packages or notify askbot maintainers at admin@askbot.org. .. _Configuration: + Configuration ==================== type:: + startforum and answer questions. @@ -82,16 +86,19 @@ In the case you are adding askbot to an existing Django project, you will need t merge askbot files settings.py_ and urls.py_ into your project files manually. Within settings.py, at the very minimum you will need to provide correct values to:: + DATABASE_NAME = '' DATABASE_USER = '' DATABASE_PASSWORD = '' within single quotes - login credential to your mysql database. Assuming that the database exists, you can now install the tables by running:: + python manage.py syncdb python manage.py migrate forum now run the development sever:: + python manage.py runserver `hostname -i`:8000 #or use some other port number > 1024 `hostname -i` is a Unix command returning the IP address of your system, you can also type @@ -102,13 +109,14 @@ Your basic installation is now complete. Many settings can be changed at runtime by following url /settings. If you choose to host a real website, please read -section Deployment_. For advice on hosting Askbot, please take -a look at section Hosting_. +section Deployment_. .. _Deployment: + Deployment ============== Webserver process must be able to write to the following locations:: + /path/to/django-project/log/ /path/to/django-project/askbot/upfiles @@ -141,58 +149,68 @@ Configure webserver Settings below are not perfect but may be a good starting point:: - WSGISocketPrefix /path/to/socket/sock #must be readable and writable by apache - WSGIPythonHome /usr/local #must be readable by apache - WSGIPythonEggs /var/python/eggs #must be readable and writable by apache + #NOTE: the directory paths used here may be adjusted + + #the following two directories must be both readable and writable by apache + WSGISocketPrefix /path/to/socket/sock + WSGIPythonEggs /var/python/eggs + + #the following directory must be readable by apache + WSGIPythonHome /usr/local #NOTE: all urs below will need to be adjusted if - #settings.FORUM_SCRIPT_ALIAS !='' (e.g. = 'forum/') + #settings.FORUM_SCRIPT_ALIAS is anything other than empty string (e.g. = 'forum/') #this allows "rooting" forum at http://example.com/forum, if you like - - ServerAdmin forum@example.com - DocumentRoot /path/to/askbot-site - ServerName example.com - - #run mod_wsgi process for django in daemon mode - #this allows avoiding confused timezone settings when - #another application runs in the same virtual host - WSGIDaemonProcess askbot - WSGIProcessGroup askbot - - #force all content to be served as static files - #otherwise django will be crunching images through itself wasting time - Alias /m/ /path/to/askbot-site/forum/skins/ - Alias /upfiles/ /path/to/askbot-site/forum/upfiles/ - + + #replace with 127.0.0.1 with real IP address + + ServerAdmin you@example.com + DocumentRoot /path/to/django-project + ServerName example.come + + #aliases to serve static media directly + #will probably need adjustment + Alias /m/ /usr/local/lib/python2.6/site-packages/askbot/skins/default/media/ + Alias /upfiles/ /path/to/django-project/askbot/upfiles/ + Alias /admin/media/ /usr/local/lib/python2.6/site-packages/django/contrib/admin/media/ + Order deny,allow Allow from all - - - #this is your wsgi script described in the prev section - WSGIScriptAlias / /path/to/askbot-site/django.wsgi - - #this will force admin interface to work only - #through https (optional) - #"nimda" is the secret spelling of "admin" ;) - - RewriteEngine on - RewriteRule /nimda(.*)$ https://example.com/nimda$1 [L,R=301] - - CustomLog /var/log/httpd/askbot/access_log common - ErrorLog /var/log/httpd/askbot/error_log + + + Order deny,allow + Allow from all + + #must be a distinct name within your apache configuration + WSGIDaemonProcess askbot2 + WSGIProcessGroup askbot2 + WSGIScriptAlias / /path/to/django-project/django.wsgi + #make all admin stuff except media go through secure connection + + RewriteEngine on + RewriteRule /admin(.*)$ https://example.com/admin$1 [L,R=301] + + CustomLog /var/log/httpd/askbot/access_log common + ErrorLog /var/log/httpd/askbot/error_log + LogLevel debug - #(optional) run admin interface under https - - ServerAdmin forum@example.com - DocumentRoot /path/to/askbot-site - ServerName example.com - SSLEngine on - SSLCertificateFile /path/to/ssl-certificate/server.crt - SSLCertificateKeyFile /path/to/ssl-certificate/server.key - WSGIScriptAlias / /path/to/askbot-site/django.wsgi - CustomLog /var/log/httpd/askbot/access_log common - ErrorLog /var/log/httpd/askbot/error_log - DirectoryIndex index.html + #again, replace the IP address + + ServerAdmin you@example.com + DocumentRoot /path/to/django-project + ServerName example.com + + RewriteEngine on + RewriteRule django.wsgi(.*)$ http://example.com$1 [L,R=301] + + SSLEngine on + #your SSL keys + SSLCertificateFile /etc/httpd/ssl.crt/server.crt + SSLCertificateKeyFile /etc/httpd/ssl.key/server.key + Alias /admin/media/ /usr/local/lib/python2.6/site-packages/django/contrib/admin/media/ + WSGIScriptAlias / /path/to/django-project/django.wsgi + CustomLog /var/log/httpd/askbot/access_log common + ErrorLog /var/log/httpd/askbot/error_log Database configuration @@ -202,6 +220,7 @@ can be created manually (provided that you have a mysql account with a sufficient privilege) The relevant MySQL the commands are:: + create database askbot DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci; grant all privileges on dbname.* to dbuser@localhost identified by 'dbpassword'; @@ -256,3 +275,5 @@ will have be indexing your site more efficiently. .. _django.wsgi: http://github.com/ASKBOT/askbot-devel/blob/master/askbot/setup_templates/django.wsgi .. _forum: http://askbot.org .. _askbot_cron_job: http://github.com/ASKBOT/askbot-devel/blob/master/askbot/cron/askbot_cron_job +.. _Django: http://djangoproject.com +.. _`easy_install`: http://pypi.python.org/pypi/setuptools diff --git a/askbot/skins/default/templates/questions.html b/askbot/skins/default/templates/questions.html index 9e6116f8..58006b77 100644 --- a/askbot/skins/default/templates/questions.html +++ b/askbot/skins/default/templates/questions.html @@ -186,7 +186,8 @@ {% endif %}
-{% cache 600 questions search_tags scope sort query %} +{% get_current_language as LANGUAGE_CODE %} +{% cache 600 questions search_tags scope sort query LANGUAGE_CODE %} {% include "question_list.html" %} {% endcache %} {% comment %}todo: fix css here{% endcomment %} diff --git a/askbot/urls.py b/askbot/urls.py index c538df3b..e108a734 100644 --- a/askbot/urls.py +++ b/askbot/urls.py @@ -188,7 +188,6 @@ urlpatterns = patterns('', app.commands.read_message, name='read_message' ), - #(r'^admin/doc/' % _('admin/doc'),include('django.contrib.admindocs.urls')), url( r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed', @@ -201,4 +200,10 @@ urlpatterns = patterns('', (r'^%s' % _('account/'), include('askbot.deps.django_authopenid.urls')), (r'^i18n/', include('django.conf.urls.i18n')), url(r'^feeds/rss/$', RssLastestQuestionsFeed, name="latest_questions_feed"), + url( + r'^doc/(?P.*)$', + 'django.views.static.serve', + {'document_root': os.path.join(APP_PATH,'doc','build','html').replace('\\','/')}, + name='askbot_media', + ), ) -- cgit v1.2.3-1-g7c22