亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
12下一頁(yè)
最近訪問(wèn)板塊 發(fā)新帖
查看: 5602 | 回復(fù): 13
打印 上一主題 下一主題

已解決-部署好apache+mod-wsgi+django環(huán)境后訪問(wèn)測(cè)試文件報(bào)錯(cuò) [復(fù)制鏈接]

論壇徽章:
2
數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2015-08-03 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-08-07 06:20:00
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2013-05-07 14:01 |只看該作者 |倒序?yàn)g覽
本帖最后由 linuxforlive 于 2013-05-14 09:25 編輯

環(huán)境apache 2.2.3 django1.1.4 mod-wsgi3.3
  1. [root@localhost mysite]# cat test.wsgi
  2. import os
  3. import sys
  4. import django.core.handlers.wsgi
  5. os.environ['PYTHON_EGG_CACHE'] = '/tmp/.python-eggs'
  6. os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
  7. app_apth = "/opt/django"
  8. sys.path.append(app_apth)
  9. application = django.core.handlers.wsgi.WSGIHandler()

  10. 報(bào)錯(cuò)如下
  11. Tue May 07 00:47:53 2013] [error] [client 192.168.202.1]     raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
  12. [Tue May 07 00:47:53 2013] [error] [client 192.168.202.1] ImproperlyConfigured: Error loading MySQLdb module: /tmp/.python-eggs/MySQL_python-1.2.2-py2.4-linux-x86_64.egg-tmp/_mysql.so: failed to map segment from shared object: Permission denied
復(fù)制代碼
小弟剛接觸python3個(gè)多月   望各位大牛指點(diǎn)一下 先謝過(guò)

論壇徽章:
2
數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2015-08-03 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-08-07 06:20:00
2 [報(bào)告]
發(fā)表于 2013-05-07 15:40 |只看該作者
補(bǔ)充一下apache配置文件如下
  1. LoadModule wsgi_module modules/mod_wsgi.so

  2. <VirtualHost *:80>
  3.     ServerAdmin webmaster@dummy-host.example.com
  4.     DocumentRoot /opt/django
  5.     ServerName www.py.com
  6.     WSGIScriptAlias /mysite /opt/django/mysite/test.wsgi
  7.     AddType text/html .py
  8. #    AddType text/html .wsgi
  9.     ErrorLog logs/www.py.com-error_log
  10.     CustomLog logs/www.py.com-access_log common

  11. <Directory /opt/django/mysite>
  12. #    Options +ExecCGI
  13.     Options ExecCGI
  14.     AllowOverride All
  15.     Allow from all
  16. </Directory>
  17. </VirtualHost>
復(fù)制代碼

論壇徽章:
1
2015年辭舊歲徽章
日期:2015-03-03 16:54:15
3 [報(bào)告]
發(fā)表于 2013-05-07 21:34 |只看該作者
回復(fù) 1# linuxforlive

python egg   在python 安裝目錄下有吧,為什么要搞到tmp下。

先不用cache 實(shí)驗(yàn)下可以嗎
   

論壇徽章:
2
數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2015-08-03 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-08-07 06:20:00
4 [報(bào)告]
發(fā)表于 2013-05-08 09:52 |只看該作者
回復(fù) 3# goldenfort


    怎么設(shè)置啊

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2013-05-08 09:58 |只看該作者
提示: 作者被禁止或刪除 內(nèi)容自動(dòng)屏蔽

論壇徽章:
2
數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2015-08-03 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-08-07 06:20:00
6 [報(bào)告]
發(fā)表于 2013-05-08 11:45 |只看該作者
回復(fù) 5# thinkc

牛啊   關(guān)閉selinux不報(bào)錯(cuò)了 但我這樣訪問(wèn)
http://192.168.202.142/mysite  會(huì)跳到我django定義的404頁(yè)面上去了
  1. 404.html代碼
  2. <h1>Page not found</h1>

  3. <p>Sorry, but the requested page could not be found.</p>
復(fù)制代碼

qi.jpg (38.13 KB, 下載次數(shù): 42)

qi.jpg

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2013-05-09 09:22 |只看該作者
提示: 作者被禁止或刪除 內(nèi)容自動(dòng)屏蔽

論壇徽章:
2
數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2015-08-03 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-08-07 06:20:00
8 [報(bào)告]
發(fā)表于 2013-05-09 09:46 |只看該作者
回復(fù) 7# thinkc
  1. 這是測(cè)試文件的內(nèi)容
  2. [root@localhost mysite]# cat test.wsgi
  3. import os
  4. import sys
  5. import django.core.handlers.wsgi
  6. os.environ['PYTHON_EGG_CACHE'] = '/tmp/.python-eggs'
  7. os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
  8. app_apth = "/opt/django"
  9. sys.path.append(app_apth)
  10. application = django.core.handlers.wsgi.WSGIHandler()

  11. 這是apache的配置文件
  12. LoadModule wsgi_module modules/mod_wsgi.so

  13. <VirtualHost *:80>
  14.     ServerAdmin webmaster@dummy-host.example.com
  15.     DocumentRoot /opt/django
  16.     ServerName www.py.com
  17.     WSGIScriptAlias /mysite /opt/django/mysite/test.wsgi
  18.     AddType text/html .py
  19. #    AddType text/html .wsgi
  20.     ErrorLog logs/www.py.com-error_log
  21.     CustomLog logs/www.py.com-access_log common

  22. <Directory /opt/django/mysite>
  23. #    Options +ExecCGI
  24.     Options ExecCGI
  25.     AllowOverride All
  26.     Allow from all
  27. </Directory>
  28. </VirtualHost>

  29. 這是django的404.html代碼

  30. <h1>Page not found</h1>

  31. <p>Sorry, but the requested page could not be found.</p>


  32. 別的關(guān)于django就沒(méi)有做設(shè)置了 django的目錄/opt/django/mysite

  33. 這是urls.py的內(nèi)容
  34. cat urls.py

  35. from django.conf.urls.defaults import *
  36. from mysite.views import hello
  37. #from mysite.views import image
  38. from mysite.views import unruly_csv
  39. from django.contrib import admin
  40. admin.autodiscover()
  41. from mysite.books import views

  42. urlpatterns = patterns('',
  43. (r'^hello/$',hello),
  44. (r'^csv/$',unruly_csv),
  45. (r'^admin/',include(admin.site.urls)),
  46. (r'^search/$',views.search),

  47. )


  48. [root@localhost mysite]# cat views.py
  49. import csv
  50. from django.http import HttpResponse
  51. UNRULY_PASSENGERS = [146,184,235,200,226,251,299,273,281,304,203]


  52. def hello(request):
  53.     return HttpResponse("Hello world")

  54. def image(request):
  55.     image_data=open("/opt/django/mysite/san.png","rb").read()
  56.     return HttpResponse(image_data,mimetype="image/png")

  57. def unruly_csv(request):
  58.     response=HttpResponse(mimetype='text/csv')
  59.     response['Content-Disposition']='attachment;filename=unruly.csv'
  60.     writer=csv.writer(response)
  61.     writer.writerow(['Year','Unruly Airline Passengers'])
  62.     for(year,num) in zip(range(1995,2006),UNRULY_PASSENGERS):
  63.          writer.writerow([year,num])
  64.     return response
復(fù)制代碼

論壇徽章:
2
數(shù)據(jù)庫(kù)技術(shù)版塊每日發(fā)帖之星
日期:2015-08-03 06:20:00IT運(yùn)維版塊每日發(fā)帖之星
日期:2015-08-07 06:20:00
9 [報(bào)告]
發(fā)表于 2013-05-09 15:55 |只看該作者
持續(xù)補(bǔ)充吧 我把test.py換成下面的形式就可以訪問(wèn)了 但是我不確定我這個(gè)好像沒(méi)有測(cè)試到django的框架是否可以使用
  1. [root@localhost mysite]# cat test.py
  2. #!/usr/bin/env python
  3. def application(environ, start_response):   
  4.     status = '200 OK'   
  5.     output = 'ssssssssshelphelpHello World!xx'  
  6.   
  7.     response_headers = [('Content-type', 'text/plain'),   
  8.                         ('Content-Length', str(len(output)))]   
  9.     start_response(status, response_headers)   
  10.   
  11.     return [output]  
復(fù)制代碼

1111.png (11.9 KB, 下載次數(shù): 43)

1111.png

論壇徽章:
0
10 [報(bào)告]
發(fā)表于 2013-05-09 17:31 |只看該作者
提示: 作者被禁止或刪除 內(nèi)容自動(dòng)屏蔽
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專(zhuān)區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP