`
lbxhappy
  • 浏览: 302696 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

apache+wsgi+django 部署django程序

 
阅读更多

1、配置 /etc/httpd/conf.d/vhost.conf

NameVirtualHost 172.16.12.61:7778  #指定部署该应用的端口

Listen 7778

<VirtualHost 172.16.12.61:7778>

  ServerName 172.16.12.61

  Alias /nvd3/ /opt/testDjango/jsDemo/nvd3/templates/  #为访问资源路径起个别名

 

  <Directory /opt/testDjango/jsDemo/nvd3/templates>

    Order deny,allow

    Allow from all

  </Directory>

  WSGIScriptAlias / /opt/testDjango/jsDemo/apache/django.wsgi

 

  <Directory /opt/testDjango/jsDemo/apache>

    Order deny,allow

    Allow from all

  </Directory>

 

  Alias /static/ /opt/testDjango/jsDemo/nvd3/static/ #配置静态资源 css js 图片

  <Directory /opt/testDjango/jsDemo/nvd3/static/>

    Order deny,allow

    Allow from all

  </Directory>

  ErrorLog logs/7778-error.log

  CustomLog logs/7778-access.log common

</VirtualHost>

保存vhost.conf文件

2、在django的urls.py里面的配置

      url(r'^.*demo1/lineBarJsonData$', handleLineChartData),

     url里面是正则表达式路径 ,对应的python接口

      访问的路径从根目录到结束路径必须匹配该路径,在此我配置为以任意字符开始以demo1/lineBarJsonData结束的路径

     可以访问方式为:demo1/lineBarJsonData 或aademo1/lineBarJsonData 或aa/demo1/lineBarJsonData

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics