首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何通过简单步骤安装osqa

如何通过简单步骤安装osqa
EN

Stack Overflow用户
提问于 2013-07-27 22:31:22
回答 4查看 3.6K关注 0票数 2

我计划使用osqa问答脚本创建一个问答网站。我想在Apache服务器上安装osqa。请告诉我在Apache服务器上安装osqa的简单但详细的步骤。

EN

回答 4

Stack Overflow用户

发布于 2013-08-30 09:40:10

如果你想要简单的东西,你可以使用bitnami栈http://bitnami.com/stack/osqa

票数 3
EN

Stack Overflow用户

发布于 2015-06-26 19:53:23

第一步:安装相关的python模块

代码语言:javascript
运行
复制
sudo apt-get install python-setuptools  #which contains easy_install 
sudo apt-get install python-pip

sudo apt-get install python-django
sudo apt-get install python-mysqldb  
sudo apt-get install libapache2-mod-wsgi  #mod-wsgi, sudo a2enmod mod-wsgi
sudo easy_install ElementTree html5lib python-openid

sudo pip install Markdown==2.4.1  #NOTE: the higher version is incompatible with osqa
sudo pip install south

Step 2:为OSQA创建数据库

代码语言:javascript
运行
复制
# (i).download the source code of OSQA
git clone https://github.com/OSQA/osqa.git

# (ii).create a database, named osqa
mysql -u root -p   #you are required to type password
create database osqa DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;


# (iii).create tables for OSQA
/var/www/osqa$ python manage.py syncdb
......
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): no
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

步骤3:配置OSQA

(i)。创建osqa.wsgi

使用cp osqa.wsgi.dist osqa.wsgi复制并修改sys.path.appendosqa.wsgi的最终内容将是

代码语言:javascript
运行
复制
import os
import sys
sys.path.append('/var/www')
sys.path.append('/var/www/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()

(ii)。创建settings_local.py

使用cp settings_local.py.dist settings_local.py制作副本并进行一些更改。下面的代码显示了应该更改的代码。

代码语言:javascript
运行
复制
DATABASES = { 
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'osqa',
        'USER': 'root',
        'PASSWORD': '**********',
        'HOST': '',
        'PORT': '',
        'CONN_MAX_AGE': 600,
    }
}

APP_URL = 'http://www.example.com

ALLOWED_HOSTS = ('example.com',)

Apache第4步:配置

为OSQA创建一个配置文件(比如osqa.conf)。内容如下:

代码语言:javascript
运行
复制
# Must be readable and writable by apache
WSGISocketPrefix ${APACHE_RUN_DIR}

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot /var/www/osqa
    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 OSQA
    WSGIProcessGroup OSQA

    #force all content to be served as static files
    #otherwise django will be crunching images through itself wasting time
    Alias /m/ "/var/www/osqa/forum/skins/"
    <Directory "/var/www/osqa/forum/skins">
        Require all granted
    </Directory>

    Alias /upfiles/ "/var/www/osqa/forum/upfiles/"
    <Directory "/var/www/osqa/forum/upfiles">
        Require all granted 
    </Directory>

    #this is your wsgi script described in the prev section
    WSGIScriptAlias / /var/www/osqa/osqa.wsgi

    CustomLog ${APACHE_LOG_DIR}/osqa.access.log common
    ErrorLog ${APACHE_LOG_DIR}/osqa.error.log
</VirtualHost>

使配置生效:

代码语言:javascript
运行
复制
sudo a2ensite osqa.conf
sudo service apache2 restart

修改hosts 第5步:修改Step

将以下内容追加到/etc/hosts

代码语言:javascript
运行
复制
xx.xx.xx.xx example.com

参考文献:

http://sparkandshine.net/install-osqa-on-aws-ec2-ubuntu-apache-mysql/

PS:为什么highligter语法不起作用?

票数 3
EN

Stack Overflow用户

发布于 2015-05-01 00:28:04

您好,我在一台新机器上做了这件事,使用的是http://wiki.osqa.net/display/docs/Ubuntu+with+Apache+and+MySQL的指南,但针对新的Apache2.4.7进行了修改,还降级了适当的django和Markdown版本

Ubuntu 14.04 Apache 2.4.7

清理AWS中的计算机:

sudo apt-get update

sudo apt-get安装apache2 libapache2-mod-wsgi

sudo apt-get install subversion

Apache2.4的行为有所不同-最好在/var/www中不饱和

sudo svn co http://svn.osqa.net/svnroot/osqa/trunk/ /var/www/osqa

sudo vi /var/www/osqa/osqa.wsgi

代码语言:javascript
运行
复制
import os
import sys
sys.path.append('/var/www')
sys.path.append('/var/www/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()

sudo rm /etc/apache2/sites enabled/000-default.conf

sudo vi /etc/apache2/sites available/osqa.conf

代码语言:javascript
运行
复制
# Must be readable and writable by apache
WSGISocketPrefix ${APACHE_RUN_DIR}

#NOTE: all urs below will need to be adjusted if
#settings.FORUM_SCRIPT_ALIAS !='' (e.g. = 'forum/')
#this allows "rooting" forum at [http://example.com/forum], if you like
<VirtualHost *:80>
    ServerAdmin forum@example.com
    DocumentRoot /var/www/osqa
    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 OSQA
    WSGIProcessGroup OSQA

    #force all content to be served as static files
    #otherwise django will be crunching images through itself wasting time
    Alias /m/ "/var/www/osqa/forum/skins/"
        <Directory "/var/www/osqa/forum/skins">
            Require all granted
        </Directory>
    Alias /upfiles/ "/var/www/osqa/forum/upfiles/"
    <Directory "/var/www/osqa/forum/upfiles">
        Require all granted 
    </Directory>

    #this is your wsgi script described in the prev section
    WSGIScriptAlias / /var/www/osqa/osqa.wsgi

    CustomLog ${APACHE_LOG_DIR}/osqa.access.log common
    ErrorLog ${APACHE_LOG_DIR}/osqa.error.log
</VirtualHost>

sudo ln -s /etc/apache2/sites-available/osqa.conf /etc/apache2/sites-enabled/osqa.conf

sudo apt-get安装mysql-client

sudo apt-get install python-setuptools

sudo apt-get install python-pip

sudo python South django-debug- easy_install markdown \ html5lib python-openid

sudo pip安装Django==1.3

sudo pip安装Markdown==2.4.1

sudo cp /var/www/osqa/settings_local.py.dist /var/www/osqa/settings_local.py

sudo vi /var/www/osqa/settings_local.py

做你的数据库工作-我已经在RDS上做了一个,但你可以自己做。

代码语言:javascript
运行
复制
DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'osqa',
            'USER': '',
            'PASSWORD': '',
            'HOST': '',
            'PORT': '3306',
        }
    }

我没有执行这一步,但是如果构建一个新的db sudo python manage.py syncdb --all,您可能需要这样做

sudo python manage.py迁移论坛--假的

sudo useradd osqa

sudo chown -R osqa:www-data /var/www/osqa

sudo chmod论坛g+w /var/www/osqa/ -R /upfiles

sudo chmod -R日志/var/www/osqa/ g+w

sudo服务apache2重启

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17898893

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档