IIS and Django

中文版:在Windows平台下的IIS中发布Django应用
英文版:Django On Windows With IIS And SQLServer

Share and Enjoy:

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Haohao
  • Live
  • MisterWong
  • Slashdot
  • TwitThis
  • Upnews
  • Yahoo! Bookmarks

Django模板中使用css, javascript

(r'^css/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/var/www/django-demo/css'}),
(r'^js/(?P</path><path>.*)$', 'django.views.static.serve', {'document_root': '/var/www/django-demo/js'}),
(r'^images/(?P</path><path>.*)$', 'django.views.static.serve', {'document_root': '/var/www/django-demo/images'}),

模板中使用下述方式即可:

<link href="/css/demo.css" type="text/css" rel="stylesheet">

注:可采用os.path.dirname(globals()["__file__"])来获得当前文件所在路径,比如

(r'^css/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.dirname(globals()["__file__"])+'/css'}),

可以使用os.path.abspath()函数返回此路径的绝对路径。

Share and Enjoy:

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Haohao
  • Live
  • MisterWong
  • Slashdot
  • TwitThis
  • Upnews
  • Yahoo! Bookmarks

The Definitive Guide to Django 2nd Edition-Using the Template System

Let’s dive into Django’s template system so you can see how it works—but we’re not yet going to integrate it with the views that we created in the previous chapter. Our goal here is to show you how the system works independent of the rest of Django. (Usually you’ll use the template system within a [...]

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Haohao
  • Live
  • MisterWong
  • Slashdot
  • TwitThis
  • Upnews
  • Yahoo! Bookmarks

LAMP平台之Ubuntu Server加AMP

昨天的MySQL安装是序曲,实质是安装LAMP的一个环节。在Ubuntu的世界里apt-get可以解决大部分的事。当然源码方式更优,但是现在还不到深入研究的时间。
./configure & make & make install 三部曲唱起来容易,唱好更难了。
使用apt-get方式在Ubuntu Server里安装AMP,步骤如下:
sudo apt-get install apache2 php5 mysql-server mysql-client php5-mysql php5-gd phpmyadmin
全部执行完毕(MySQL环节见昨天的日志),访问
http://xxx.xxx.xxx.xxx/phpmyadmin/
就可以了。真是简单快捷,居家调试LAMP程序必备呀。
索性再增加个python支持:
sudo apt-get install python libapache2-mod-python python-django
注:
phpmyadmin安装目录在/usr/share/phpmyadmin/

Share and Enjoy:

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Haohao
  • Live
  • MisterWong
  • Slashdot
  • TwitThis
  • Upnews
  • Yahoo! Bookmarks