django的编码规范
settings.py中要使用相对路径:
import os
DIRNAME = os.path.dirname(__file__)# 1)去掉文件名的路径 2)__file__为本settings.py文件
MEDIA_ROOT = os.path.join(DIRNAME, '静态路径')
网站目录规范:
example.com/
-README
-settings.py
-urls.py
-APP1/
-APP2/
+docs/
#This will hold the documentation for your project
+static/
#In production this will be the root of your MEDIA_URL
+css/
+js/
+images/
+tests/
#Project level tests (Each app should also have tests)
+uploads/
+content imgs, etc
+templates/
#This area is used to override templates from your reusable apps
+flatpages/
+comments/
+example/
+app1/
+app2/
import os
DIRNAME = os.path.dirname(__file__)# 1)去掉文件名的路径 2)__file__为本settings.py文件
MEDIA_ROOT = os.path.join(DIRNAME, '静态路径')
网站目录规范:
example.com/
-README
-settings.py
-urls.py
-APP1/
-APP2/
+docs/
#This will hold the documentation for your project
+static/
#In production this will be the root of your MEDIA_URL
+css/
+js/
+images/
+tests/
#Project level tests (Each app should also have tests)
+uploads/
+content imgs, etc
+templates/
#This area is used to override templates from your reusable apps
+flatpages/
+comments/
+example/
+app1/
+app2/
![](http://img.zemanta.com/pixy.gif?x-id=7490be1f-5791-875d-b562-8ac1eeca4e22)