Ubuntu下python Django apache环境搭建

if you encounter these problems during your installation:

1. no module named modpython
[color=red] solution: download the modpython.py, and copy to '/usr/local/lib/python2.7/dist-packages/django/core/handler'[/color]

2. no module named server.settings(your project name.settings)
[color=red] solution: check the urls in your apache2 config file-->httpd.conf or default, especially the 'PythonPath'[/color]

for example:
1. create a new project named myproject:
/media/DATA/MyDocuments/python_ubuntu/django$ sudo python /usr/local/lib/python2.7/dist-packages/django/bin/django-admin.py startproject myproject

2. configurate the apache2 httpd.conf:
$ cd /etc/apache2
$ sudo gedit httpd.conf

<Location "/myproject/">

SetHandler python-program
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
PythonPath "['/media/DATA/MyDocuments/python_ubuntu/django'] + sys.path"
PythonHandler django.core.handlers.modpython
PythonDebug On

</Location>

3. start off your apache2:
$ cd /etc/init.d
$ sudo ./apache2 restart

everything is done!


suffered terrible problems and drove me crazy
when they were fixed, feeling so great!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值